jpadilla / pyjwt

JSON Web Token implementation in Python
https://pyjwt.readthedocs.io
MIT License
5.17k stars 688 forks source link

Version 2.6 breaks unit tests #836

Closed LukasKlement closed 1 year ago

LukasKlement commented 1 year ago

Framework used: Django 4.1.4 / Django Restframework 3.14.0 / Django Restframework SimpleJWT 5.2.2 pyjwt version: 2.6

The following code works in pyjwt 2.5 but fails with pyjwt 2.6:

from rest_framework.test import APIClient
client = APIClient()
client.login(username='username', password='pass')
client.credentials(**self.create_headers('username')) # function returns the HTTP_AUTHORIZATION header

client.post(url, data)
# EXPECTED: status 201
# ACTUAL: status 401

Here is the error under pyjwt 2.6:

{'detail': ErrorDetail(string='Given token not valid for any token type', code='token_not_valid'), 'code': ErrorDetail(string='token_not_valid', code='token_not_valid'), 'messages': [{'token_class': ErrorDetail(string='AccessToken', code='token_not_valid'), 'token_type': ErrorDetail(string='access', code='token_not_valid'), 'message': ErrorDetail(string='Token is invalid or expired', code='token_not_valid')}]}

The release notes did not indicate a breaking change, am I missing something?

github-actions[bot] commented 1 year ago

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

auvipy commented 1 year ago

can you verify if this is fixed in main branch now?

github-actions[bot] commented 1 year ago

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