Identity & access
Sessions, logout and revocation
How a signed-in session ends: RP-initiated logout, token revocation, second factors and the consent screen.
Three things end a session
- Your session
- The server-side record your application keeps. Delete it, and the browser is signed out of your app immediately — nothing else has to happen.
- The provider session
- The IdP's own cookie. Until it is cleared, re-launching any application silently signs the person back in without a prompt.
- The tokens
- Access tokens expire in 15 minutes; refresh tokens live 30 days until revoked. Revocation is what makes a stolen refresh token useless.
Signing out properly
// 1. Revoke the refresh token first, while you still hold it.
await fetch(`${issuer}/token/revocation`, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
token: session.refreshToken,
token_type_hint: "refresh_token",
client_id: process.env.VERSIFIED_CLIENT_ID!,
}),
});
// 2. Delete your own session record.
// 3. Send the browser to the provider's end-session endpoint with the
// ID token hint and the exact post-logout redirect you registered:
// `${issuer}/session/end?id_token_hint=${idToken}`
// `&post_logout_redirect_uri=${encodeURIComponent(returnTo)}`Skip step 3 and the person is not signed out
Deleting only your own session produces the confusing behaviour where signing out and immediately launching an app signs the person back in, with no prompt and no consent screen.
Second factor and consent
- Two-factor authentication is a property of the person, configured once, enforced at the provider. Your application never sees the second factor and must not try to reimplement it.
- A consent screen appears the first time a client asks for scopes it has not been granted. A client marked
trustedskips it; that flag is reserved for first-party clients and can only be set by a super admin. - The
auth_methodused for a sign-in is recorded server-side. It is the audit answer to "was this password, Google or a refresh?".
Something here out of date or unclear?
The platform team answers integration questions directly.
