Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions gotrue/_async/gotrue_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from contextlib import suppress
from functools import partial
from json import loads
from time import time
Expand All @@ -16,6 +17,7 @@
STORAGE_KEY,
)
from ..errors import (
AuthApiError,
AuthImplicitGrantRedirectError,
AuthInvalidCredentialsError,
AuthRetryableError,
Expand Down Expand Up @@ -483,10 +485,12 @@ async def sign_out(self) -> None:
There is no way to revoke a user's access token jwt until it expires.
It is recommended to set a shorter expiry on the jwt for this reason.
"""
session = await self.get_session()
access_token = session.access_token if session else None
if access_token:
await self.admin.sign_out(access_token)
with suppress(AuthApiError):
session = await self.get_session()
access_token = session.access_token if session else None
if access_token:
await self.admin.sign_out(access_token)

await self._remove_session()
self._notify_all_subscribers("SIGNED_OUT", None)

Expand Down
12 changes: 8 additions & 4 deletions gotrue/_sync/gotrue_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from contextlib import suppress
from functools import partial
from json import loads
from time import time
Expand All @@ -16,6 +17,7 @@
STORAGE_KEY,
)
from ..errors import (
AuthApiError,
AuthImplicitGrantRedirectError,
AuthInvalidCredentialsError,
AuthRetryableError,
Expand Down Expand Up @@ -481,10 +483,12 @@ def sign_out(self) -> None:
There is no way to revoke a user's access token jwt until it expires.
It is recommended to set a shorter expiry on the jwt for this reason.
"""
session = self.get_session()
access_token = session.access_token if session else None
if access_token:
self.admin.sign_out(access_token)
with suppress(AuthApiError):
session = self.get_session()
access_token = session.access_token if session else None
if access_token:
self.admin.sign_out(access_token)

self._remove_session()
self._notify_all_subscribers("SIGNED_OUT", None)

Expand Down