-
Notifications
You must be signed in to change notification settings - Fork 688
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
Switch from itsdangerous to another JWT library #6224
Comments
I'm still looking around, but authlib seems very heavy for our pretty minimal needs. I think something smaller that just does JWT/JWS might be a better fit? E.g. https://github.com/jpadilla/pyjwt Via tokei, authlib is 17K Python LOC, while pyjwt is 1.6K (just the library, excluding tests). |
I reviewed the libraries listed at https://jwt.io/libraries?language=Python:
I'll push a PR to use pyjwt in a few minutes. |
itsdangerous deprecated TimedJSONWebSignatureSerializer in 2.0 and has entirely removed it in 2.1, so we need to switch to something else. They recommended authlib, except that's a pretty large general-purpose authentication library. pyjwt is a smallish (1k LOC) library that just provides JWT/JWS functionality. For the HS512 algorithm, it uses the same implementation from hashlib in the Python standard library as itsdangerous did. Tests are provided to verify successful operation as well as different failure modes, such as invalid tokens, incorrect secret key, wrong algorithm, and lack of an expiry. Tokens generated by itsdangerous are not decodable by pyjwt because itsdangerous passed the expiry as a header while pyjwt includes the expiry in the body/payload itself. This shouldn't be a significant issue since these tokens already expire after 8 hours. Fixes #6224.
Description
An upcoming release of
itsdangerous
, 2.1, will drop support for JSON Web Signatures. The project maintainers recommend switching toauthlib
instead. Encountered the deprecation notice while performing a diff review. See this relevant GitHub issue with maintainer comments.The text was updated successfully, but these errors were encountered: