Skip to content

Commit

Permalink
feat: add reauthenticate method (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
silentworks authored Sep 2, 2024
1 parent d47daf1 commit d54feeb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions supabase_auth/_async/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,18 @@ async def verify_otp(self, params: VerifyOtpParams) -> AuthResponse:
self._notify_all_subscribers("SIGNED_IN", response.session)
return response

async def reauthenticate(self) -> AuthResponse:
session = await self.get_session()
if not session:
raise AuthSessionMissingError()

return await self._request(
"GET",
"reauthenticate",
jwt=session.access_token,
xform=parse_auth_response,
)

async def get_session(self) -> Union[Session, None]:
"""
Returns the session, refreshing it if necessary.
Expand Down
12 changes: 12 additions & 0 deletions supabase_auth/_sync/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,18 @@ def verify_otp(self, params: VerifyOtpParams) -> AuthResponse:
self._notify_all_subscribers("SIGNED_IN", response.session)
return response

def reauthenticate(self) -> AuthResponse:
session = self.get_session()
if not session:
raise AuthSessionMissingError()

return self._request(
"GET",
"reauthenticate",
jwt=session.access_token,
xform=parse_auth_response,
)

def get_session(self) -> Union[Session, None]:
"""
Returns the session, refreshing it if necessary.
Expand Down

0 comments on commit d54feeb

Please sign in to comment.