Skip to content
Snippets Groups Projects
Commit 4958c80c authored by Klaas Kliffen's avatar Klaas Kliffen :satellite:
Browse files

Add padding to fix base64 decode

parent 4e283ac2
Branches
No related tags found
1 merge request!8SDC-307 Cern dlaas notebook
......@@ -104,7 +104,9 @@ class shopping_client:
return False
try:
payload = json.loads(base64.urlsafe_b64decode(token.split(".")[1]))
data = token.split(".")[1]
padded = data + "=" * divmod(len(token), 4)[1]
payload = json.loads(base64.urlsafe_b64decode(padded))
return payload["exp"] > int(time.time()) + 10
except KeyError:
raise RuntimeError("Invalid JWT format")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment