Azure / Azure/static-web-apps

Auth0 Logout Not Fully Clearing Session on Azure Static Web Apps

Open
#1,627 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I’m experiencing an issue where logging out from Auth0 works locally but fails on Azure Static Web Apps. Even after calling /api/auth/logout, the session remains active, and Auth0 cookies (appSession, auth_verification) are restored.

**What I Have Tried:**

✅ Ensured the Auth0 logout URL is correctly set in the Auth0 dashboard.
✅ Used /api/auth/logout instead of a direct redirect to Auth0’s logout URL.
✅ Tried clearing cookies manually (client-side and server-side) but appSession persists.
✅ Called /.auth/logout before redirecting to /api/auth/logout. However, a cors error occurs when making this request.
✅ Disabled caching using Cache-Control: no-store, no-cache, must-revalidate.
✅ Tested in Incognito mode to rule out local caching.

**Observations:**

- Deleting cookies manually via the browser instantly logs out the user, but doing so via code does not work.
- Azure appears to be restoring the session cookies after logout.

**Questions:**

1. Is there a way to prevent Azure from persisting authentication cookies?
2. How can we fully clear the Auth0 session when logging out on Azure Static Web Apps?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.