[Vuejs]-How djoser make jwt in django rest

0👍

You can solve the problem here, jwt for the django rest-framework
How do I get the Django login api to work after extending the user object?

you can to this, for django jwt

You can do this

settings.py

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.BasicAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.TokenAuthentication',
    ]
}

INSTALLED_APPS = ['rest_framework','rest_framework.authtoken']

urls.py

from rest_framework.authtoken import views
urlpatterns += [
    path('api-token-auth/', views.obtain_auth_token)
]

python manage.py migrate

curl -X POST -d "username=username&password=password123" http://localhost:8000/api-token-auth/

Leave a comment