django-jwt-auth
Ready-to-use django app for users authentication via JWT
Prepare environment
First of all, type pip install -r requirements.txt
to install all required packages.
Update settings.py file
Make sure your INSTALLED_APPS
list contains jwt_auth.apps.JwtAuthConfig
, rest_framework
and rest_framework.authtoken
. Add REST_FRAMEWORK
dictionary and define default permission and authentications classes:
REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_simplejwt.authentication.JWTAuthentication', ) }
Migration
Migrate all changes with python manage.py migrate
and you're ready to go.