From 4b74d3798f87bf991042965eb547470dcc0c68e2 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Tue, 1 Jul 2025 00:11:20 +0100 Subject: [PATCH] fix: add missing email_redirect_to option --- supabase_auth/_async/gotrue_client.py | 6 +++++- supabase_auth/_sync/gotrue_client.py | 6 +++++- supabase_auth/types.py | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/supabase_auth/_async/gotrue_client.py b/supabase_auth/_async/gotrue_client.py index e76be9d1..25facea0 100644 --- a/supabase_auth/_async/gotrue_client.py +++ b/supabase_auth/_async/gotrue_client.py @@ -79,6 +79,7 @@ SignOutOptions, SignUpWithPasswordCredentials, Subscription, + UpdateUserOptions, UserAttributes, UserIdentity, UserResponse, @@ -647,7 +648,9 @@ async def get_user(self, jwt: Optional[str] = None) -> Optional[UserResponse]: return None return await self._request("GET", "user", jwt=jwt, xform=parse_user_response) - async def update_user(self, attributes: UserAttributes) -> UserResponse: + async def update_user( + self, attributes: UserAttributes, options: UpdateUserOptions = {} + ) -> UserResponse: """ Updates user data, if there is a logged in user. """ @@ -658,6 +661,7 @@ async def update_user(self, attributes: UserAttributes) -> UserResponse: "PUT", "user", body=attributes, + redirect_to=options.get("email_redirect_to"), jwt=session.access_token, xform=parse_user_response, ) diff --git a/supabase_auth/_sync/gotrue_client.py b/supabase_auth/_sync/gotrue_client.py index de05af55..a575f57b 100644 --- a/supabase_auth/_sync/gotrue_client.py +++ b/supabase_auth/_sync/gotrue_client.py @@ -79,6 +79,7 @@ SignOutOptions, SignUpWithPasswordCredentials, Subscription, + UpdateUserOptions, UserAttributes, UserIdentity, UserResponse, @@ -645,7 +646,9 @@ def get_user(self, jwt: Optional[str] = None) -> Optional[UserResponse]: return None return self._request("GET", "user", jwt=jwt, xform=parse_user_response) - def update_user(self, attributes: UserAttributes) -> UserResponse: + def update_user( + self, attributes: UserAttributes, options: UpdateUserOptions = {} + ) -> UserResponse: """ Updates user data, if there is a logged in user. """ @@ -656,6 +659,7 @@ def update_user(self, attributes: UserAttributes) -> UserResponse: "PUT", "user", body=attributes, + redirect_to=options.get("email_redirect_to"), jwt=session.access_token, xform=parse_user_response, ) diff --git a/supabase_auth/types.py b/supabase_auth/types.py index add18e64..c2441369 100644 --- a/supabase_auth/types.py +++ b/supabase_auth/types.py @@ -87,6 +87,10 @@ class Options(TypedDict): captcha_token: NotRequired[str] +class UpdateUserOptions(TypedDict): + email_redirect_to: NotRequired[str] + + class InviteUserByEmailOptions(TypedDict): redirect_to: NotRequired[str] data: NotRequired[Any]