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
No related branches found
No related tags found
1 merge request!8SDC-307 Cern dlaas notebook
...@@ -104,7 +104,9 @@ class shopping_client: ...@@ -104,7 +104,9 @@ class shopping_client:
return False return False
try: 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 return payload["exp"] > int(time.time()) + 10
except KeyError: except KeyError:
raise RuntimeError("Invalid JWT format") 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