supabase-rb-rb
Auth

Sign out a user

Revoke the current session and clear local storage.

Sign the current user out. The default scope: "global" revokes every refresh token issued to the user (every device); scope: "local" only revokes the current session; scope: "others" revokes every other session but keeps the current one alive.

For any scope other than "others", the local session is also removed from storage and a SIGNED_OUT event is dispatched to on_auth_state_change subscribers. API errors from the underlying call are suppressed so logout always clears local state.

Signature

supabase.auth.sign_out(options = {})

options is an optional hash carrying a single scope: key.

Parameters

NameTypeRequiredDescription
optionsHashOptionalSign-out options hash. Only key today is :scope.
scopeStringOptionalNested under options. One of "global" (default — revoke every refresh token), "local" (revoke only this session), or "others" (revoke every other session, keep this one).

Returns

Returns
nil

Returns nil. There is no return value to inspect — assume success if no exception escapes. (API errors from the admin sign-out call are caught and suppressed so local state is always cleared.)

Example — global sign-out (default)

supabase.auth.sign_out
# Every refresh token for this user is now revoked across all devices.
# Local session removed, SIGNED_OUT event dispatched.

Example — local-only sign-out

supabase.auth.sign_out(scope: "local")
# Only this device's session is revoked; other devices stay signed in.
# Local session still removed, SIGNED_OUT event still dispatched.

Example — sign other devices out, stay on this one

supabase.auth.sign_out(scope: "others")
# Every OTHER session is revoked; this device's session keeps working.
# Local session is NOT removed and no SIGNED_OUT event is dispatched.

AuthApiError from the underlying admin call is rescued so logout always succeeds locally even if the network revoke fails.

On this page