token authentication

This commit is contained in:
2023-02-22 12:38:33 +01:00
parent 9546d99d66
commit 5af19ed4c3
2 changed files with 14 additions and 2 deletions

View File

@@ -31,9 +31,20 @@ INSTALLED_APPS = [
'compra.apps.CompraConfig',
# Terceras partes
'rest_framework',
'rest_framework.authtoken',
'djoser'
]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES':
('rest_framework.authentication.TokenAuthentication', ),
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
]
}
# configure Djoser
DJOSER = {"USER_ID_FIELD": "email"}
AUTH_USER_MODEL = 'authentication.User'
MIDDLEWARE = [

View File

@@ -3,10 +3,11 @@ from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('auth/', include('authentication.urls')),
path('users/', include('authentication.urls')),
path('comparte/', include('comparte.urls')),
path('compra/', include('compra.urls')),
path('item/', include('item.urls')),
path('lista/', include('lista.urls')),
path('token/', include('djoser.urls')),
path('auth/', include('djoser.urls')),
path('auth/', include('djoser.urls.authtoken'))
]