Skip to content

Commit

Permalink
fix: add channel to sign_in and sign_up options
Browse files Browse the repository at this point in the history
  • Loading branch information
silentworks authored Jun 20, 2024
2 parents e4fc889 + 1df49ef commit 498640d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion supabase_auth/_async/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ async def sign_up(
phone = credentials.get("phone")
password = credentials.get("password")
options = credentials.get("options", {})
redirect_to = options.get("redirect_to")
redirect_to = options.get("redirect_to") or options.get("email_redirect_to")
data = options.get("data") or {}
channel = options.get("channel", "sms")
captcha_token = options.get("captcha_token")
if email:
response = await self._request(
Expand All @@ -217,6 +218,7 @@ async def sign_up(
"phone": phone,
"password": password,
"data": data,
"channel": channel,
"gotrue_meta_security": {
"captcha_token": captcha_token,
},
Expand Down Expand Up @@ -419,6 +421,7 @@ async def sign_in_with_otp(
email_redirect_to = options.get("email_redirect_to")
should_create_user = options.get("create_user", True)
data = options.get("data")
channel = options.get("channel", "sms")
captcha_token = options.get("captcha_token")
if email:
return await self._request(
Expand All @@ -443,6 +446,7 @@ async def sign_in_with_otp(
"phone": phone,
"data": data,
"create_user": should_create_user,
"channel": channel,
"gotrue_meta_security": {
"captcha_token": captcha_token,
},
Expand Down
6 changes: 5 additions & 1 deletion supabase_auth/_sync/gotrue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,9 @@ def sign_up(
phone = credentials.get("phone")
password = credentials.get("password")
options = credentials.get("options", {})
redirect_to = options.get("redirect_to")
redirect_to = options.get("redirect_to") or options.get("email_redirect_to")
data = options.get("data") or {}
channel = options.get("channel", "sms")
captcha_token = options.get("captcha_token")
if email:
response = self._request(
Expand All @@ -217,6 +218,7 @@ def sign_up(
"phone": phone,
"password": password,
"data": data,
"channel": channel,
"gotrue_meta_security": {
"captcha_token": captcha_token,
},
Expand Down Expand Up @@ -419,6 +421,7 @@ def sign_in_with_otp(
email_redirect_to = options.get("email_redirect_to")
should_create_user = options.get("create_user", True)
data = options.get("data")
channel = options.get("channel", "sms")
captcha_token = options.get("captcha_token")
if email:
return self._request(
Expand All @@ -443,6 +446,7 @@ def sign_in_with_otp(
"phone": phone,
"data": data,
"create_user": should_create_user,
"channel": channel,
"gotrue_meta_security": {
"captcha_token": captcha_token,
},
Expand Down
2 changes: 2 additions & 0 deletions supabase_auth/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class SignUpWithEmailAndPasswordCredentials(TypedDict):
class SignUpWithPhoneAndPasswordCredentialsOptions(TypedDict):
data: NotRequired[Any]
captcha_token: NotRequired[str]
channel: NotRequired[Literal["sms", "whatsapp"]]


class SignUpWithPhoneAndPasswordCredentials(TypedDict):
Expand Down Expand Up @@ -313,6 +314,7 @@ class SignInWithPhoneAndPasswordlessCredentialsOptions(TypedDict):
should_create_user: NotRequired[bool]
data: NotRequired[Any]
captcha_token: NotRequired[str]
channel: NotRequired[Literal["sms", "whatsapp"]]


class SignInWithPhoneAndPasswordlessCredentials(TypedDict):
Expand Down

0 comments on commit 498640d

Please sign in to comment.