Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 8b81588

Browse files
authored
fix: sms mfa failure due to missing totp field (#723)
1 parent 59fddd4 commit 8b81588

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

supabase_auth/_async/gotrue_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,14 @@ async def _enroll(self, params: MFAEnrollParams) -> AuthMFAEnrollResponse:
805805
raise AuthSessionMissingError()
806806

807807
body = {
808-
"friendly_name": params["friendly_name"],
809-
"factor_type": params["factor_type"],
808+
"friendly_name": params.get("friendly_name"),
809+
"factor_type": params.get("factor_type"),
810810
}
811811

812812
if params["factor_type"] == "phone":
813-
body["phone"] = params["phone"]
813+
body["phone"] = params.get("phone")
814814
else:
815-
body["issuer"] = params["issuer"]
815+
body["issuer"] = params.get("issuer")
816816

817817
response = await self._request(
818818
"POST",

supabase_auth/_sync/gotrue_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -801,14 +801,14 @@ def _enroll(self, params: MFAEnrollParams) -> AuthMFAEnrollResponse:
801801
raise AuthSessionMissingError()
802802

803803
body = {
804-
"friendly_name": params["friendly_name"],
805-
"factor_type": params["factor_type"],
804+
"friendly_name": params.get("friendly_name"),
805+
"factor_type": params.get("factor_type"),
806806
}
807807

808808
if params["factor_type"] == "phone":
809-
body["phone"] = params["phone"]
809+
body["phone"] = params.get("phone")
810810
else:
811-
body["issuer"] = params["issuer"]
811+
body["issuer"] = params.get("issuer")
812812

813813
response = self._request(
814814
"POST",

supabase_auth/types.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from time import time
55
from typing import Any, Callable, Dict, List, Optional, Union
66

7-
from pydantic import BaseModel, ConfigDict
7+
from pydantic import BaseModel, ConfigDict, Field
88

99
try:
1010
# > 2
@@ -643,7 +643,7 @@ class AuthMFAEnrollResponse(BaseModel):
643643
"""
644644
Type of MFA factor. Only `totp` supported for now.
645645
"""
646-
totp: AuthMFAEnrollResponseTotp
646+
totp: Optional[AuthMFAEnrollResponseTotp] = None
647647
"""
648648
TOTP enrollment information.
649649
"""
@@ -680,7 +680,9 @@ class AuthMFAChallengeResponse(BaseModel):
680680
"""
681681
Timestamp in UNIX seconds when this challenge will no longer be usable.
682682
"""
683-
factor_type: Optional[Literal["totp", "phone"]] = None
683+
factor_type: Optional[Literal["totp", "phone"]] = Field(
684+
validation_alias="type", default=None
685+
)
684686
"""
685687
Factor Type which generated the challenge
686688
"""

0 commit comments

Comments
 (0)