Skip to main content
Everything on this page is opt-in. Nothing changes until you pass the option.
A browser holds an identity cookie and a token cookie. The server checks that the token cookie is bound to the identity cookie and refuses a token cookie taken from another user.

Stateless sessions bind the token cookie to the user.

A signed cookie that answers validateSession without a database read. It exists only on createCookieSessionManager. createTheAuth does not use it, and the reserved sessionsCache secondary storage name is not read by core. It is not revocation safe. A revoked, banned or signed out everywhere session keeps validating from the cache until the cache cookie expires (5 minutes by default), and a cache hit also skips the idle timeout check. Nothing binds the cookie to a revocation version, so keep maxAge to seconds, or leave it off when a ban must take effect at once.
Rotating the cache secret: createSessionCookieCache and createStatelessSessions take secret: string | string[] (or entries shaped { id, secret }). With an array, the first entry signs and every entry verifies, so cookies issued before a rotation keep working. Add the new secret first and deploy, then remove the old one once the longest cookie lifetime (maxAge) has passed. Each secret must be at least 32 bytes, and empty or duplicate entries throw at construction. createCookieSessionManager still passes its single secret string to the cache. The cookie is signed, not encrypted, and tied to the session token it was issued for. Payloads past about 3.6 KB are chunked; oversized ones fall back to database reads.

Refresh token reuse grace

Strict one-time use stays the default. Set reuseGracePeriod (capped at 5 minutes) to tolerate a lost rotation response or two tabs refreshing at once. A token reused inside the window gets a fresh pair; outside it, the whole family is revoked as before.

Per-request base URL

Set allowedHosts (and trustForwardedHeaders only behind a proxy that overwrites the headers) so OAuth redirect URIs follow the request host. Hosts outside the list fall back to baseUrl.

Stateless sessions and federated logout

createStatelessSessions keeps an IdP identity in signed cookies and the IdP tokens in an encrypted cookie, with no database. Sessions cannot be revoked server side, so pair it with isRevoked and createBackChannelLogoutReceiver, which verifies OIDC logout tokens (issuer, audience, jti replay) and calls your onLogout. createEndSessionHandler and buildEndSessionUrl cover RP-initiated logout. The encrypted token cookie is bound to the identity cookie, so one user’s token cookie cannot be swapped into another user’s session. Cookies written before the binding existed (no v2: prefix) are refused by default. If you upgrade with live sessions and want to keep them, set acceptLegacyTokenCookies: true for one cookie lifetime (maxAge). Legacy cookies are re-sealed in the bound format as they are read, and onDeprecation reports each one. Users whose cookie is refused sign in again once.

Secure cookies by default

Session, cache, refresh and plugin cookies are Secure on every runtime, with no NODE_ENV check. See Cookie options for the https, trusted proxy and localhost rules and for __Host- prefix validation.
Last modified on October 18, 2026