Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions supabase_auth/_sync/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def sign_up_with_email(
data = {"email": email, "password": password, "data": data}
url = f"{self.url}/signup{query_string}"
response = self.http_client.post(url, json=data, headers=headers)
SessionOrUserModel = determine_session_or_user_model_from_response(response)
return SessionOrUserModel.parse_response(response)
session_or_user_model = determine_session_or_user_model_from_response(response)
return session_or_user_model.parse_response(response)

def sign_in_with_email(
self,
Expand Down Expand Up @@ -211,8 +211,8 @@ def sign_up_with_phone(
data = {"phone": phone, "password": password, "data": data}
url = f"{self.url}/signup"
response = self.http_client.post(url, json=data, headers=headers)
SessionOrUserModel = determine_session_or_user_model_from_response(response)
return SessionOrUserModel.parse_response(response)
session_or_user_model = determine_session_or_user_model_from_response(response)
return session_or_user_model.parse_response(response)

def sign_in_with_phone(
self,
Expand Down Expand Up @@ -335,8 +335,8 @@ def verify_mobile_otp(
data["redirect_to"] = redirect_to_encoded
url = f"{self.url}/verify"
response = self.http_client.post(url, json=data, headers=headers)
SessionOrUserModel = determine_session_or_user_model_from_response(response)
return SessionOrUserModel.parse_response(response)
session_or_user_model = determine_session_or_user_model_from_response(response)
return session_or_user_model.parse_response(response)

def invite_user_by_email(
self,
Expand Down Expand Up @@ -637,8 +637,8 @@ def generate_link(
data["redirect_to"] = redirect_to_encoded
url = f"{self.url}/admin/generate_link"
response = self.http_client.post(url, json=data, headers=headers)
SessionOrUserModel = determine_session_or_user_model_from_response(response)
return SessionOrUserModel.parse_response(response)
session_or_user_model = determine_session_or_user_model_from_response(response)
return session_or_user_model.parse_response(response)

def set_auth_cookie(self, *, req, res):
"""Stub for parity with JS api."""
Expand Down
6 changes: 3 additions & 3 deletions supabase_auth/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ def decode_jwt_payload(token: str) -> Any:
parts = token.split(".")
if len(parts) != 3:
raise ValueError("JWT is not valid: not a JWT structure")
base64Url = parts[1]
base64url = parts[1]
# Addding padding otherwise the following error happens:
# binascii.Error: Incorrect padding
base64UrlWithPadding = base64Url + "=" * (-len(base64Url) % 4)
return loads(urlsafe_b64decode(base64UrlWithPadding).decode("utf-8"))
base64url_with_padding = base64url + "=" * (-len(base64url) % 4)
return loads(urlsafe_b64decode(base64url_with_padding).decode("utf-8"))


def generate_pkce_verifier(length=64):
Expand Down