Skip to main content
A session is a pair of tokens: Change the lifetimes in the guard settings.

Refresh a session

POST /auth/{guard}/refresh — API key only, no Bearer token.
Returns a new session (access_token and refresh_token), the same shape as login.
Refresh tokens rotate. Each refresh revokes the refresh token you sent. Always store the new one. Reusing an old refresh token returns 401 invalid_or_expired_token.

When to refresh

  • Proactively: shortly before expires_in runs out.
  • Reactively: when a request returns 401, refresh once and retry.
If two browser tabs refresh at the same time, one of them will use a token that was just rotated. Share one refresh in progress across your app (see the JavaScript client).

Log out

POST /auth/{guard}/logout — needs the Bearer token. Revokes one refresh token (this device).

Log out everywhere

POST /auth/{guard}/logout-all — needs the Bearer token. Revokes all of the user’s refresh tokens.
Use it for “Sign out of all devices” or after a security concern.
Logout revokes refresh tokens. Access tokens are stateless and stay valid until they expire (15 minutes by default). Keep jwt_ttl short, and delete tokens from the client on logout.

What ends a session

Storing tokens

Never log tokens or put them in URLs.