Fix · Sign-in and accounts
Users get logged out after a refresh or a page change
Blocks your work
What you may see
- I log in, move to another page and I am logged out
- The server sees no user though the browser shows one
Most likely cause
The login is kept in a cookie; if the cookie is not set, not sent to the server, expires too soon, or the server code cannot read it, the user looks logged out.
Check first (about two minutes)
- In the browser's Application tab, after logging in, is there a session cookie for your site?
- Does it break only on the live site or only on one browser?
The fix prompt
What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.
Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.
Prompt language
Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.
After you tried it, did it work?
Steps
- Find how sessions are created and read on the server (which library, which helper), and which routes check them.
- Check cookie settings: secure on https, the right domain and path, SameSite lax, and a sensible lifetime.
- Make sure the session is refreshed in the one place the library documents (often a middleware), and that responses carry the updated cookies.
Do not do this
- Do not make cookies readable by page scripts to "fix" it.
- Do not store the login token in localStorage to work around it.