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

Commit f77663a

Browse files
authored
Merge pull request #254 from supabase-community/j0/patch_padding_for_base64
fix: patch padding for base64
2 parents 5d075d2 + a37afe3 commit f77663a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gotrue/helpers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,7 @@ def decode_jwt_payload(token: str) -> Any:
8383
if len(parts) != 3:
8484
raise ValueError("JWT is not valid: not a JWT structure")
8585
base64Url = parts[1]
86-
return loads(b64decode(base64Url).decode("utf-8"))
86+
# Addding padding otherwise the following error happens:
87+
# binascii.Error: Incorrect padding
88+
base64UrlWithPadding = base64Url + "=" * (-len(base64Url) % 4)
89+
return loads(b64decode(base64UrlWithPadding).decode("utf-8"))

0 commit comments

Comments
 (0)