Skip to content

fix(auth): clear local storage on signOut when session is already missing#2026

Merged
mandarini merged 1 commit into
supabase:masterfrom
7ttp:fix/signout-clear-storage-on-missing-session
Jan 22, 2026
Merged

fix(auth): clear local storage on signOut when session is already missing#2026
mandarini merged 1 commit into
supabase:masterfrom
7ttp:fix/signout-clear-storage-on-missing-session

Conversation

@7ttp

@7ttp 7ttp commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes signOut throwing AuthSessionMissingError and leaving stale session data in local storage when the session was already invalidated from another device.

Problem

When a user signs out globally from one device, all sessions are invalidated on the server. If the user then tries to call signOut() from a second device, the method throws AuthSessionMissingError and returns early without clearing the local storage. This leaves the client in a broken state with stale session data.

Solution

Handle AuthSessionMissingError in _signOut by:

  1. Not returning early when sessionError is AuthSessionMissingError
  2. Ignoring AuthSessionMissingError from admin.signOut alongside existing 404/401/403 handling

This ensures local storage is always cleared when signOut is called, regardless of server-side session state.

Related

@7ttp 7ttp requested review from a team as code owners January 16, 2026 18:44
@coveralls

coveralls commented Jan 16, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 80.901% (-0.02%) from 80.916%
when pulling b4b6c45 on 7ttp:fix/signout-clear-storage-on-missing-session
into 188b83f on supabase:master.

@mandarini mandarini force-pushed the fix/signout-clear-storage-on-missing-session branch from a807149 to b4b6c45 Compare January 22, 2026 10:35
@mandarini mandarini merged commit 4e199fd into supabase:master Jan 22, 2026
24 checks passed
@7ttp 7ttp deleted the fix/signout-clear-storage-on-missing-session branch January 25, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: trying to signOut of an invalid session should still clear local storage

3 participants