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
Make sure admin powers are checked on the server
The admin page is hidden from normal users, and the role is read from something the browser controls.
Sign-in works locally and fails on the live site
You land back on localhost, hit a redirect error, or stay signed out after logging in.
Check every page and API route is protected
Pages are hidden in the menu, but anyone with the URL can still call them.
Add Google sign-in without breaking existing accounts
Social login looks like one button and turns into consent screens, callback URLs and duplicate users.