Repository navigation
Conversation
irisfield
force-pushed
the
fix/auth-sign-out-scope
branch
from
October 25, 2026 22:10
df50e3b to
43d9b31
Compare
irisfield
marked this pull request as draft
October 26, 2026 21:28
irisfield
marked this pull request as ready for review
October 29, 2026 00:34
Contributor
Author
|
@grdsdev When you get a chance, could you take a look at this one? It brings |
This branch has not been deployed
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 kind of change does this PR introduce?
Bug fix. Closes #1823.
What is the current behavior?
sign_out()suppresses everyAuthApiErrorand nothing else, so whether a failed logout request clears the local session depends on how the error was classified, not on the scope. Withglobal, a 429 or a JSON 500 clears the session and returns without an error even though the server revoked nothing, while a 503 raises and keeps it. Withlocal, a 503 keeps the session.What is the new behavior?
I moved the
admin.sign_out()call into its owntry. A 401, 403, 404 orAuthSessionMissingErrorcounts as already signed out (_is_signed_out_error), and any other error is handled by scope, following supabase/supabase-js#2786:globalraises and keeps the session, so the call can be retried or replaced with alocalsign out.localremoves the session and emitsSIGNED_OUTbefore sending the request, then raises if the request fails. If the access token has expired and the refresh fails with anAuthRetryableError, it still removes the session before raising. ASIGNED_OUTsubscriber that raises does not stop the request, and its error is raised after the request is sent.othersraises and keeps the session.The
sign_out()docstring now describes each scope.Additional context
globalcallers that get a 429 or a JSON 500 now see an exception where they used to get a silent success.