No module named 'rest_framework_simplejwt'
Install rest_framework_simplejwt
pip install djangorestframework_simplejwt
Add to Installed Apps
INSTALLED_APPS = [
...
'rest_framework',
'rest_framework_simplejwt',
...
]
URL Configuration
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
urlpatterns = [
...
path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
...
]
Settings Configuration
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
...
],
}