Skip to content
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

Removal of kwargs in v2.2.0 is a breaking API change #698

Closed
zaccrites opened this issue Oct 11, 2021 · 6 comments
Closed

Removal of kwargs in v2.2.0 is a breaking API change #698

zaccrites opened this issue Oct 11, 2021 · 6 comments

Comments

@zaccrites
Copy link

Example: LibrePhotos/librephotos#373

TypeError: decode() got an unexpected keyword argument 'verify'

See also https://stackoverflow.com/questions/69485121/django-rest-framework-simple-jwt-decode-got-an-unexpected-keyword-argument-v

Internal Server Error: /api/rqavailable/
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 497, in dispatch
    self.initial(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 414, in initial
    self.perform_authentication(request)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 324, in perform_authentication
    request.user
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/request.py", line 227, in user
    self._authenticate()
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/request.py", line 380, in _authenticate
    user_auth_tuple = authenticator.authenticate(self)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/authentication.py", line 35, in authenticate
    validated_token = self.get_validated_token(raw_token)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/authentication.py", line 89, in get_validated_token
    return AuthToken(raw_token)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/tokens.py", line 42, in __init__
    self.payload = token_backend.decode(token, verify=verify)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/backends.py", line 68, in decode
    return jwt.decode(token, self.verifying_key, algorithms=[self.algorithm], verify=verify,
TypeError: decode() got an unexpected keyword argument 'verify'

Expected Result

This error should not occur.

Actual Result

The verify keyword argument is now rejected.

Reproduction Steps

In this case, installing LibrePhotos using Docker Compose. The problem API call is in Django's rest framework JWT, but the version constraints allowed it to pick up a minor revision which contained a breaking change.

System Information

PyJWT version is 2.2.0. Downgrading to 2.1.0 fixes the problem.

@auvipy
Copy link
Collaborator

auvipy commented Oct 11, 2021

@dajiaji

@champax
Copy link

champax commented Oct 11, 2021

Confirmed, same issue here, 2.1.0 is fine

@dajiaji
Copy link
Contributor

dajiaji commented Oct 11, 2021

@zaccrites

As I mentioned in #657 (comment), I think the change (removal of kwargs) should have been included in v2.0.0. Anyway, I'm sorry for bothering you.

I've sent djangorestframework-simplejwt a PR to follow the latest(2.2.0) PyJWT. I'm glad if you can wait for a while until the PR is merged and a new version of simplejwt is released.

@auvipy
Copy link
Collaborator

auvipy commented Oct 11, 2021

what about just revert that nd wait for v3.0

@dajiaji
Copy link
Contributor

dajiaji commented Oct 11, 2021

what about just revert that nd wait for v3.0

Thanks for your suggestion. I thought it would be better that way too. I'll send a PR to revert (but wait for a couple of days because I cannot have enough time to do).

@jpadilla @auvipy could you release v2.2.1 after that? Sorry for bothering you.

@bj00rn
Copy link

bj00rn commented Oct 18, 2021

I see that #703 is merged. Will there be a release anytime soon? /Cheers!

@auvipy auvipy closed this as completed Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants