-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
algorithm
parameter must be specified as "none" instead of None
#1022
Comments
This seems to come from #979. |
This change was documented as part of v2.10.0 in the changelog: https://github.com/jpadilla/pyjwt/blob/3ebbb22f30f2b1b41727b269a08b427e9a85d6bb/CHANGELOG.rst#v2100 |
I ran into the same issue. This is effectively a breaking change that should have been shipped with a major version bump. |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
contributions are welcome to fix this |
@auvipy The original implementation had a sentinel value of sorts but that was discouraged here #979 (comment). Would fixing this issue make a revert of 4c61e92 viable as a solution? |
you can come with a draft PR |
There was a change in the 2.10.0 update where passing
None
to thealgorithm
parameter injwt.encode()
would result in thealgoritm_
class member being set to "HS256" instead of "none".File: jwt/api_jws.py:118-124
Expected Result
I have a test where I run something like:
This test used to pass with pyjwt version 2.9.0.
Actual Result
After the update to 2.10.0 this test fails.
After investigating, I found that pyjwt sets the algorithm to "HS256" when I set it to
None
, where before it was set to "none". This means I need to specifyalgorithm="none"
for the test to pass.Conclusion
I think this change from
jwt.encode(..., algorithm=None)
tojwt.encode(..., algorithm="none")
is a lot less intuitive. If HS256 is going to be a default that's applied when algorithm is specified asNone
, I think this should also be documented.The text was updated successfully, but these errors were encountered: