Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Merged
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
5 changes: 4 additions & 1 deletion gotrue/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,7 @@ def decode_jwt_payload(token: str) -> Any:
if len(parts) != 3:
raise ValueError("JWT is not valid: not a JWT structure")
base64Url = parts[1]
return loads(b64decode(base64Url).decode("utf-8"))
# Addding padding otherwise the following error happens:
# binascii.Error: Incorrect padding
base64UrlWithPadding = base64Url + "=" * (-len(base64Url) % 4)
return loads(b64decode(base64UrlWithPadding).decode("utf-8"))