Skip to content

Sign-in and accounts

Stop users getting logged out at random

People are signed out mid-task, or stay signed in forever on a shared computer.

What you get
How long a session lasts and how it renews, written down and matching what the code does.
Paste it into
Your AI tool, in your project
The prompt
Users of my app get signed out unexpectedly, and I don't know how long sessions are meant to last.

Explain how sessions work in this project: where the session lives (a cookie or browser storage), how long it lasts, how it renews, and what happens on sign-out, on a password change, and when a tab has been idle. Give me the file and line for each.

Find the reason someone could be signed out early: a refresh that isn't happening on the server, cookies not passed through middleware, a mismatch between domains, or an assumption about clocks. Fix it. Then recommend session lengths for this kind of app and make sure sign-out really ends the session on the server.

Use it

Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in.

More in Sign-in and accounts