parent
226c0f3a54
commit
2c98d99818
3 changed files with 78 additions and 1 deletions
|
|
@ -5499,7 +5499,8 @@ def jwt_encode_hs256(payload_data, key, headers={}):
|
|||
# can be extended in future to verify the signature and parse header and return the algorithm used if it's not HS256
|
||||
def jwt_decode_hs256(jwt):
|
||||
header_b64, payload_b64, signature_b64 = jwt.split('.')
|
||||
payload_data = json.loads(base64.urlsafe_b64decode(payload_b64))
|
||||
# add trailing ='s that may have been stripped, superfluous ='s are ignored
|
||||
payload_data = json.loads(base64.urlsafe_b64decode(f'{payload_b64}==='))
|
||||
return payload_data
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue