-
-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration guide for python-jose users #942
Comments
I have looked through the
|
get_unverified_headerfrom jose import jwt
jwt.get_unverified_header(token) import jwt
jwt.get_unverified_header(token) base64url_decodefrom jose.utils import base64url_decode from jwt.utils import base64url_decode Lines 28 to 33 in 7b4bc84
JWTErrorjose's JWTError's subclasses are JWTClaimsError and ExpiredSignatureError. from jose import JWTError from jwt import InvalidTokenError Line 9 in 72ad55f
pyjwt has ExpiredSignatureError, and multiple errors to cover JWTClaimsError. |
For my needs, I just haven't figured out the replacement for jwk.construct() (docs). I probably need to do something with PyJWK? from jose import jwk
key = jwk.construct(data)
key.verify(msg, sig) import jwt
obj = jwt.PyJWK(data)
# ??? Edit: This seems to work: import jwt
obj = jwt.PyJWK(data)
alg_obj = obj.Algorithm
prepared_key = alg_obj.prepare_key(obj.key)
alg_obj.verify(msg, prepared_key, sig) |
It appears that
python-jose
is unmaintained, itself depends on unmaintaiend projects and now also suffers from dependencies with security vulnerabilities:mpdavis/python-jose#341
As such I am looking to migrate to this package. Most of the methods appear to be 100% API compatible. There is no
get_unverified_claims()
butjwt.decode(token, options={"verify_signature": False})
is easy enough to use in its place though having a dedicated function with such a clear name might be a good idea to facilitate defensive coding practices.Where I am struggeling is that with
python-jose
I can pass in the RSA key as a dict (containing then
,e
etc. values) tojwt.decode()
rather than a PEM-formatted public key as expected in this package. I didn't find a function to generate a PEM in this package. Or am I missing something?The text was updated successfully, but these errors were encountered: