Repository navigation
feat(auth): sign a user out from their access token as an admin - #594
Merged
Merged
Conversation
Tr00d
force-pushed
the
feat/auth.admin.sign_out
branch
from
October 29, 2026 14:29
cc6f3ec to
2c88ac8
Compare
Tr00d
marked this pull request as ready for review
October 29, 2026 15:00
Tr00d
force-pushed
the
feat/auth.admin.sign_out
branch
from
October 29, 2026 15:03
2c88ac8 to
a6f2b1e
Compare
This was referenced Nov 3, 2026
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.
Summary
A server holding the admin client can sign a user out from their access token, revoking that user's sessions in the chosen scope.
Capability:
auth.admin.sign_out: Admin Sign Out.Public API
New types: none.
IGotrueApi<TUser, TSession>gainsSignOutAsync(string jwt, SignOutScope, CancellationToken), which carries the cancellation token. The existingSignOut(jwt, scope)is unchanged and shares its request code with the new member.Behavior
POST /logout?scope=global|local|otherswith an empty{}body.Authorization: Bearer <user access token>;apikeyis the configured header. The service key is not sent: the auth server authenticates/logoutwith the user's token and does not check for admin.accessToken, required.scope, defaultGlobal.ArgumentExceptionwhenaccessTokenis null, empty or whitespace. Otherwise the server would answer 401no_authorization.GotrueException:ErrorCode = session_not_found(403) when the token's session was already revoked;ErrorCode = user_not_found(403) when its user was deleted;Reason = AdminTokenRequired(403bad_jwt) when the token is expired, malformed or carries no user.Deviations from supabase-js
None in behavior. Like supabase-js's
auth.admin.signOut, failures are reported rather than swallowed, unlike a client's own sign-out, which ignores 401/403/404. The scope is an enum, so the invalid-scope error supabase-js throws cannot happen.Tests
SignOut/AdminSignOutTestsGetUser→session_not_found). Signing out an already revoked session →ErrorCode = session_not_found.SignOut/AdminSignOutContractTestsPOST /logoutwith the user's token as Bearer and the configured apikey. Global by default. Each scope's query value. 403session_not_foundsurfaced. A cancelled token sends nothing.SignOut/AdminSignOutAccessTokenTestsChanged-line coverage: 100% (8 lines). Mutation: 7/7 killed on changed lines, 0 survivors.
No wire-shape approval snapshot: the body is always
{}. Existing stateless sign-out tests cover it.Layout
Sign-out adds no types, so it has no production folder. Its tests sit in
packages/Gotrue/Gotrue.Tests/SignOut/, named afterSignOutAsync. The classes keep theAdminprefix to set them apart from the client's own session sign-out tests (Authentication/SignOutLocalSessionTests).Notes
IGotrueStatelessClient.SignOut(accessToken, options, scope)already made the same request, but on the stateless client, with noAsyncsuffix and no cancellation token. It is left as is.bad_jwtmaps toFailureHint.Reason.AdminTokenRequiredglobally. For this method the bad token is the user's, soAdminTokenRequiredis misleading here. The raw code stays available onErrorCode. Changing the mapping changes the error contract of every admin method, so it belongs in v9.