Skip to content

Commit 498640d

Browse files
authored
fix: add channel to sign_in and sign_up options
2 parents e4fc889 + 1df49ef commit 498640d

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

supabase_auth/_async/gotrue_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ async def sign_up(
191191
phone = credentials.get("phone")
192192
password = credentials.get("password")
193193
options = credentials.get("options", {})
194-
redirect_to = options.get("redirect_to")
194+
redirect_to = options.get("redirect_to") or options.get("email_redirect_to")
195195
data = options.get("data") or {}
196+
channel = options.get("channel", "sms")
196197
captcha_token = options.get("captcha_token")
197198
if email:
198199
response = await self._request(
@@ -217,6 +218,7 @@ async def sign_up(
217218
"phone": phone,
218219
"password": password,
219220
"data": data,
221+
"channel": channel,
220222
"gotrue_meta_security": {
221223
"captcha_token": captcha_token,
222224
},
@@ -419,6 +421,7 @@ async def sign_in_with_otp(
419421
email_redirect_to = options.get("email_redirect_to")
420422
should_create_user = options.get("create_user", True)
421423
data = options.get("data")
424+
channel = options.get("channel", "sms")
422425
captcha_token = options.get("captcha_token")
423426
if email:
424427
return await self._request(
@@ -443,6 +446,7 @@ async def sign_in_with_otp(
443446
"phone": phone,
444447
"data": data,
445448
"create_user": should_create_user,
449+
"channel": channel,
446450
"gotrue_meta_security": {
447451
"captcha_token": captcha_token,
448452
},

supabase_auth/_sync/gotrue_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ def sign_up(
191191
phone = credentials.get("phone")
192192
password = credentials.get("password")
193193
options = credentials.get("options", {})
194-
redirect_to = options.get("redirect_to")
194+
redirect_to = options.get("redirect_to") or options.get("email_redirect_to")
195195
data = options.get("data") or {}
196+
channel = options.get("channel", "sms")
196197
captcha_token = options.get("captcha_token")
197198
if email:
198199
response = self._request(
@@ -217,6 +218,7 @@ def sign_up(
217218
"phone": phone,
218219
"password": password,
219220
"data": data,
221+
"channel": channel,
220222
"gotrue_meta_security": {
221223
"captcha_token": captcha_token,
222224
},
@@ -419,6 +421,7 @@ def sign_in_with_otp(
419421
email_redirect_to = options.get("email_redirect_to")
420422
should_create_user = options.get("create_user", True)
421423
data = options.get("data")
424+
channel = options.get("channel", "sms")
422425
captcha_token = options.get("captcha_token")
423426
if email:
424427
return self._request(
@@ -443,6 +446,7 @@ def sign_in_with_otp(
443446
"phone": phone,
444447
"data": data,
445448
"create_user": should_create_user,
449+
"channel": channel,
446450
"gotrue_meta_security": {
447451
"captcha_token": captcha_token,
448452
},

supabase_auth/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class SignUpWithEmailAndPasswordCredentials(TypedDict):
260260
class SignUpWithPhoneAndPasswordCredentialsOptions(TypedDict):
261261
data: NotRequired[Any]
262262
captcha_token: NotRequired[str]
263+
channel: NotRequired[Literal["sms", "whatsapp"]]
263264

264265

265266
class SignUpWithPhoneAndPasswordCredentials(TypedDict):
@@ -313,6 +314,7 @@ class SignInWithPhoneAndPasswordlessCredentialsOptions(TypedDict):
313314
should_create_user: NotRequired[bool]
314315
data: NotRequired[Any]
315316
captcha_token: NotRequired[str]
317+
channel: NotRequired[Literal["sms", "whatsapp"]]
316318

317319

318320
class SignInWithPhoneAndPasswordlessCredentials(TypedDict):

0 commit comments

Comments
 (0)