jazzband / djangorestframework-simplejwt

A JSON Web Token authentication plugin for the Django REST Framework.
https://django-rest-framework-simplejwt.readthedocs.io/
MIT License
3.81k stars 648 forks source link

Import "rest_framework_simplejwt.authentication" could not be resolved Pylance (reportMissingImports) #788

Open jbiddulph opened 1 month ago

jbiddulph commented 1 month ago

this in my code doesn't seem to be working:

from rest_framework_simplejwt.authentication import JWTAuthentication

authentication_classes = [JWTAuthentication]

here's my requirements.txt:

asgiref>=3.7.2
django>=4.2.11
django-cors-headers>=4.3.1
djangorestframework>=3.14.0
djangorestframework-simplejwt==5.3.1
mysqlclient>=2.2.4
pillow>=10.2.0
pip>=24.0
PyJWT>=2.8.0
pytz>=2024.1
setuptools>=58.0.4
sqlparse>=0.4.4
typing_extensions>=4.10.0

I just keep getting 401 unauthorized: { "detail": "Given token not valid for any token type", "code": "token_not_valid", "messages": [ { "token_class": "AccessToken", "token_type": "access", "message": "Token is invalid or expired" } ] }

Andrew-Chen-Wang commented 1 month ago

giving a reproducible example would be helpful with detailed steps and code, thanks:)

Andrew-Chen-Wang commented 1 month ago

Installing django-stubs will be helpful for pylance