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]