ImportError: Could not import 'rest_framework_simplejwt.authentication.JWTAuthentication'
It seems you are confusing two packages. djangorestframework-jwt
which you have in your requirements.txt is no longer maintained. It provides the rest_framework_jwt.authentication.JSONWebTokenAuthentication
authentication class.
However, the one you are actually using, rest_framework_simplejwt.authentication.JWTAuthentication
, comes from the pip package djangorestframework-simplejwt
So you need to update your requirements.txt. Remove djangorestframework-jwt
and add djangorestframework-simplejwt
for me the djangorestframework-simplejwt
upgrade from 4.4.0
to current latest version 4.6.0
fixed the problem.
pip3 install --upgrade djangorestframework-simplejwt
If anyone still encountering this error, this is the requirements for djangorestframework-simplejwt:
Python (3.6, 3.7, 3.8)
Django (2.0, 2.1, 2.2, 3.0)
Django REST Framework (3.8, 3.9, 3.10)
I downgraded Django & DRF and the problem is solved for me.
pip uninstall django
pip uninstall djangorestframework
pip install --upgrade django==3.0
pip install --upgrade djangorestframework==3.10
pip install djangorestframework-simplejwt