How Logout Works in FusionAuth
On this page
A user who logs in through FusionAuth holds several sessions at once. Logout has to end each one, and no single call ends them all. For the session types, see How Sessions Work.
What Each Logout Method Ends#
| Method | Called from | SSO session | Refresh tokens | Other applications' Logout URL |
|---|---|---|---|---|
/oauth2/logout |
Browser | Ends | Unchanged | Loaded, unless Logout behavior is Redirect only |
/api/logout |
Browser or server, no API key | Unchanged | Revokes the one refresh token sent | Not loaded |
/api/logout with global set to true |
Browser or server, no API key | Ends | Revokes all of the user's refresh tokens | Not loaded |
DELETE /api/jwt/refresh |
Server, with an API key | Ends when you revoke by user | Revokes by token, user, or Application | Not loaded |
| Admin UI Users -> The User -> Sessions | Admin UI | Ends when you delete the single-sign-on row |
Revokes the rows you delete | Not loaded |
/account/logout |
Browser | Ends, then continues to /oauth2/logout |
Revokes the account management session | Loaded, as with /oauth2/logout |
| SAML Single Logout | SAML service provider | Ends | Unchanged | With Single Logout enabled, sends SAML logout requests to the other service providers in the session |
No method ends an access token that a client already holds. The access token stays valid until the token expires.
No method ends an upstream Identity Provider session. A user who logs in with Google and then logs out of FusionAuth stays logged in to Google. For a workaround, see Log Out of an Identity Provider.
Front-Channel Logout#
FusionAuth implements OpenID Connect Front-Channel Logout at /oauth2/logout. Your application ends the local session, then redirects the browser to /oauth2/logout. FusionAuth ends the SSO session and renders a logout page.
The logout page loads the Logout URL of every Application in the Tenant in a hidden iframe. FusionAuth loads every Application that has a Logout URL, including Applications the user never logged in to. FusionAuth appends the iss and sid parameters to each URL. Code at each Logout URL ends that application's session. When the iframes finish, FusionAuth redirects the browser to the post_logout_redirect_uri, or to the Logout URL of the Application that started the logout.
Front-channel logout across two applications.
Each iframe loads a different site than the FusionAuth page. The browser sends the application's session cookie to the iframe only when the cookie allows cross-site use. Set the application's session cookie to SameSite=None; Secure, which requires HTTPS. Browsers that block third-party cookies can still drop the cookie. When the iframe can't read the session cookie, the code at the Logout URL can't find the session to end. For a design that doesn't depend on cookies in iframes, use centralized sessions.
Logout Behavior#
Each Application's Logout behavior setting controls what happens when logout starts from that Application:
All applicationsloads every Logout URL in the Tenant, then redirects.All applicationsis the default.Redirect onlyends the SSO session and redirects, without loading the other applications' Logout URL. The other applications keep their sessions.
With either value, /oauth2/logout ends the SSO session. The next login redirect from any application shows the login form.
Back-Channel Logout#
FusionAuth doesn't implement OpenID Connect Back-Channel Logout. To end sessions from a server without a browser, use centralized sessions and revoke refresh tokens with the API. For the steps, see View and Revoke Sessions.
Related
Learn how to log users out of one application or every application, and where to send users after logout.
Learn about how FusionAuth keeps users logged in across applications, and how to configure session lifetimes, single sign-on, and logout.
Learn how to list a user's sessions and end the sessions from the Admin UI, the API, or automatically.
Learn how to fix common problems with FusionAuth SSO, session lifetimes, and logout.