Repository navigation
fix(auth): emit a sessionMissing sign out for an unreadable stored session at startup - #2107
Merged
spydon merged 2 commits intoOct 29, 2026
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…-sign-out-reason-for-explicit-sign-outs
spydon
deleted the
lukasklingsbo/sdk-2599-auth-report-the-right-sign-out-reason-for-explicit-sign-outs
branch
October 29, 2026 18:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When the session persisted by an earlier run cannot be restored at startup, because the stored value cannot be parsed or is missing required data, the auth client now emits
signedOutwithSignOutReason.sessionMissingafterinitialSession(null). Before, the value was removed silently and listeners only sawinitialSession(null), the same as a user who was never signed in. This matches theauth.session.sign_out_reasonspec, which definessessionMissingfor this case.A startup with nothing stored is unchanged and only emits
initialSession(null).How
_readPersistedSessionreports whether it discarded a stored value._restoreSessionthen emits the sign out in a later event loop turn, so a listener that subscribes right afterinitializedcompletes, asawait Supabase.initialize()followed byonAuthStateChange.listendoes, still receives it after its initial event.supabase_flutterdoes nothing special forsignedOut. TheSupabaseClientlistener resets the realtime token to the API key, which it already is with no session.Scope
This is part 2 of SDK-2599 only. Part 1, the reason and exception for an explicit global or others sign out with a rejected refresh token, waits for the sign out spec in supabase/sdk#302 to be settled.
No public API changes, so
sdk-compliance.yamlis unchanged.Tests
session_persistence_test.dartno longer locks in the silent removal. It now covers an unparseable value, a session without user data, a session without an access token, a subscriber arriving once the client is initialized, a sign in that follows the restore, and a startup with nothing stored. Thesupabase_auth,supabaseandsupabase_fluttersuites pass locally against the local stack.