python-jose
python-jose copied to clipboard
[BUG] Weird: decode of encode does not work with quotes inside string
jwt.decode(jwt.encode({'test': 0, 'exp': 1647029460}, 'test'), 'test')
-> {'test': 0, 'exp': 1647029460}
But,
jwt.decode(jwt.encode({'test': 0, 'exp': 1647029460}, '"test"'), '"test"')
-> JWTError: Signature verification failed.
I ran into this today and found its due to this line:
https://github.com/mpdavis/python-jose/blob/82cd15fa81eec17798015c4b9b96aacd1ae0fbfb/jose/jws.py#L226
The quirky way json keys are handled unquotes keys. Possibly to support json keys with firebase certs the code should detect the presence of a {