Skip to content

Commit be3d4fc

Browse files
committed
Make get_unverified_claims() return a dict
So far the above method returned the unprocessed string it received from `_load()`. This commit parses the payload before returning it in order to comply with the documentation.
1 parent 252ecd5 commit be3d4fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jose/jws.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ def get_unverified_claims(token):
124124
JWSError: If there is an exception decoding the token.
125125
"""
126126
header, claims, signing_input, signature = _load(token)
127-
return claims
127+
128+
try:
129+
return json.loads(claims.decode('utf-8'))
130+
except ValueError as e:
131+
raise JWSError('Invalid claims string: %s' % e)
128132

129133

130134
def _encode_header(algorithm, additional_headers=None):

0 commit comments

Comments
 (0)