Skip to main content
Upgrading the packages changes nothing for your users until you set auth.session.persistent. Without it there are no new routes, cookies or tables, and error bodies stay as they were.

1. Upgrade the packages

Move @glinr/theauth, and @glinr/theauth-client and @glinr/theauth-react if you use them, to the releases that include persistent sessions. Upgrade @glinr/theauth-cli with them to get the doctor checks.

2. Check your session lifetime

Startup fails when persistent.idleTimeoutMs is not longer than the session maxAge:
maxAge defaults to 7 days and idleTimeoutMs to 30. If you raised maxAge to keep people signed in, lower it now, since the remember cookie takes over that job. A day or less is a reasonable starting point.

3. Apply migration 0016

It creates theauth_session_families and theauth_session_family_tokens and changes no existing table. It runs only when auth.session.persistent is set. SQL Server users run applyMssqlSchema, which creates the two tables. Prisma users also add the two models to their schema.

4. Know what changes once it is on

If you delete session rows yourself, with SQL or your own scripts, the device behind them can still refresh. Call theauth.persistentSessions.revokeBySession or revokeAll instead.

5. Configure

Before you deploy, check:
  • Every instance gets the same remember secret.
  • Behind a TLS terminating proxy, trustedProxy is set. Without it an https base URL makes the refresh route answer insecure_transport.
  • A frontend on another origin is listed in the handler’s trustedOrigins. The remember cookie is SameSite=Lax, so that origin must be on the same site as the auth routes.

6. Update the client

Without this step the checkbox has no visible effect.
  • With @glinr/theauth-client or @glinr/theauth-react, pass { remember } to signIn and send your API calls through the store’s fetch. See client and React.
  • With your own client, refresh once and retry once on session_expired, and never send users to sign-in on a network error, 429 or 5xx.
  • Server rendered pages call refreshFromRequest in the page gate, or the refreshPageSession of your framework adapter.
  • A Next.js app using @glinr/theauth-nextjs-auth sets persistent.
  • With createTheAuthGoClient, pass remember to login, signup or passkeys.login.

7. Add a device list

Build a “your devices” screen on GET /auth/session-families, with rename, sign out and forget. It differs from a sessions list: a remembered device whose session has expired still appears, with live: false.

8. Roll it out

  1. Deploy with migration 0016 applied and the flag off.
  2. Ship the client change. It does nothing while the feature is off.
  3. Turn the flag on in staging. Sign in with the box ticked, delete the session cookie in the browser, reload, and confirm one refresh followed by the retried request.
  4. Turn it on in production. To limit it to a group of users first, return false from eligible for everyone else.
  5. Watch for session.reuse_detected. A steady stream usually means a client or proxy drops Set-Cookie headers or restores old cookies.
Run theauth doctor against the config to catch very long lifetimes.

Turn it off again

Remove auth.session.persistent and deploy. The refresh and device routes disappear, remember cookies are ignored, and users sign in again when their current session ends. Sessions already issued stay valid until they expire. The rows stay in the database, and revocations made while the feature is off do not update them. If you may turn it back on, empty both tables first, or old remember cookies that have not expired can work again:

Downgrade

Turn the feature off first, then roll the packages back.
  • Migration 0016 is additive, so an older version of @glinr/theauth runs against the migrated database. It ignores both tables, and theauth db status lists 0016 as unknown to that version. This does not stop startup.
  • Remove the persistent key from your config if the older version’s types reject it.
  • A session that was created by a refresh may show an extra theauthRefreshed key in session.metadata on the older version until it expires.
  • Client packages can be rolled back on their own. An older client does not refresh, so users sign in again when their session ends.
You do not need to drop the tables. If you do, also delete the ledger row. Without that, a later upgrade treats 0016 as applied and does not recreate them:
Dropping the tables signs every remembered device out for good.
Last modified on December 3, 2026