python-jose icon indicating copy to clipboard operation
python-jose copied to clipboard

[BUG] Weird: decode of encode does not work with quotes inside string

Open thomashlvt opened this issue 3 years ago • 1 comments

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.

thomashlvt avatar Feb 25 '22 20:02 thomashlvt

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 {

andychase avatar Mar 14 '25 19:03 andychase