SolidJSS
SolidJS13mo ago
3 replies
binajmen

`useSession()` unexpectedly changing

I'm having a hard time with useSession() and I'm not sure how to articulate my issue. I have some routes protected by a getAdmin() query, redirecting the visitor if is not logged and not admin. The process is working, and the session is supposed to be valid for 14 days. However, after 1 click, or after n clicks – it varies, it does not work anymore.

I noticed in the request header in my browser that the cookie value is changing when it happens: from cockpit=Fe26.2**78859073ec... (the valid/logged cookie) to cockpit=Fe26.2**1be0589ce4be (the invalid/blank cookie) without specific reasons.

What I noticed though is that the cookie is changing due to the response of the admin layout route as shown in the screenshot.
Screenshot_2025-01-07_at_17.24.14.png
Was this page helpful?