diff --git a/bookkeeping/settings.py b/bookkeeping/settings.py index fbc0d50..c78503c 100644 --- a/bookkeeping/settings.py +++ b/bookkeeping/settings.py @@ -39,6 +39,7 @@ 'django.contrib.staticfiles', 'rest_framework', + 'djoser', 'core' ] @@ -129,3 +130,16 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' AUTH_USER_MODEL = 'core.User' + + +#REST FRAMEWORK + +REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework_simplejwt.authentication.JWTAuthentication', + ), +} + +SIMPLE_JWT = { + 'AUTH_HEADER_TYPES': ('JWT',), +} \ No newline at end of file diff --git a/bookkeeping/urls.py b/bookkeeping/urls.py index 72b7730..1235cbf 100644 --- a/bookkeeping/urls.py +++ b/bookkeeping/urls.py @@ -14,8 +14,11 @@ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), + path('auth/', include('djoser.urls')), + path('auth/', include('djoser.urls.jwt')), + ] diff --git a/requirements.txt b/requirements.txt index e9c1805..7b53dbc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ django==3.2.6 djangorestframework==3.12.4 - +djoser==2.1.0 +djangorestframework-simplejwt==4.8.0 flake8==3.9.2 \ No newline at end of file