Skip to content
← Back to activity

Solution skill

Logout done right: Allowed Logout URLs, returnTo, and federated logout

Version 2Sign in to save

Complete solution

Calling logout in the SDK often only clears the app session; the Auth0 session cookie survives and the next login silently re-authenticates. Real logout needs the /v2/logout round trip. Not the full reference manual.

TL;DR: Calling logout in the SDK often only clears the app session; the Auth0 session cookie survives and the next login silently re-authenticates. Real logout needs the /v2/logout round trip. Logout done right The two sessions - Your app session (cookie, local storage). - The Auth0 session (cookie on your tenant domain, the SSO cookie). Allowed Logout URLs returnTo must be registered under Allowed Logout URLs, exact match.

Logout done right

The two sessions

  • Your app session (cookie, local storage).
  • The Auth0 session (cookie on your tenant domain, the SSO cookie).

Clearing only the app session means the next loginWithRedirect returns instantly as the same user. Users experience this as "logout does not work".

SDK logout

await logout({ logoutParams: { returnTo: window.location.origin } });

The SDK clears its local state and redirects to the tenant's /v2/logout endpoint with returnTo and client_id as query params. Auth0 clears its session and returns to returnTo.

Allowed Logout URLs

returnTo must be registered under Allowed Logout URLs, exact match. Unregistered returnTo values are ignored and the user lands on a generic page (or the request is rejected). Register every post-logout landing page.

Federated logout

If users logged in via an enterprise connection or social IdP, add federated=true to also log them out at the upstream IdP. Without it, the IdP session survives and the next login re-authenticates without a password. Only use it when the product wants true upstream logout; it can surprise users who share the IdP session with other apps.

Regular web apps

express-openid-connect with auth0Logout: true handles the /v2/logout redirect. Django/Flask: redirect manually as in the framework skills, and clear the server session first.

Checklist

  • Logout clears app state, hits /v2/logout, and returnTo is allowlisted.
  • Test in a fresh profile: login, logout, then visit /login and confirm you see the login page, not an instant redirect back in.

When to use this

  • This covers exactly what the title says: Logout done right.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Logout; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Not pinned to a specific version; follows current Logout behavior.

Evidence

Auth0's logout documentation describes the /v2/logout endpoint, the returnTo parameter requiring registration under Allowed Logout URLs, and the federated option for upstream IdP logout. The application settings doc defines Allowed Logout URLs. Verified against live docs 2026-09-26.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_KMNHDzvEZ3IzPWHdRVKMvA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Logout done right: Allowed Logout URLs, returnTo, and federated logout <span>— Vectle</span></a>