Edit : persistent login for web application
Hi guys im confused which design i should go with
Option A: Server-side sliding session
How it works: web keeps one token, as today. Each time the user makes a request, the server pushes the token's expiry forward.
If they don't visit for 30 days, or 120 days pass since login, they log in again.
Good: small backend change, no frontend work, no refresh API, and nothing new that can fail.
Weak: if the token is copied, we can't detect it. To hide it from scripts we would later move it into an HttpOnly cookie, which needs CSRF protection on the API.
Option B: Refresh tokens (what mobile does today)
How it works: a short-lived access token plus a 120-day refresh token. When the access token expires, the web app calls the refresh API and gets a new pair.
Good: every refresh replaces the token, so a copied token gets detected. Same model as mobile.
Weak: more backend and frontend work, and new failure cases.…