simple jwt tidak dipakai

This commit is contained in:
Irwan Cahyono 2025-07-31 13:53:45 +07:00
parent cd593b8e5c
commit 4c3f4c6640
2 changed files with 28 additions and 9 deletions

View File

@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
from pathlib import Path
from decouple import config, Csv
from datetime import timedelta
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
@ -159,18 +160,18 @@ REST_FRAMEWORK = {
'DEFAULT_FILTER_BACKENDS': [
'django_filters.rest_framework.DjangoFilterBackend'
],
# 'DEFAULT_AUTHENTICATION_CLASSES': (
# 'rest_framework.authentication.BasicAuthentication',
# 'rest_framework.authentication.SessionAuthentication',
# 'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
# ),
# 'DEFAULT_PERMISSION_CLASSES': (
# 'rest_framework.permissions.IsAuthenticated',
# )
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
# 'rest_framework_simplejwt.authentication.JWTAuthentication',
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
)
}
OAUTH2_PROVIDER = {
# this is the list of available scopes
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
}
@ -192,3 +193,20 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
DATA_UPLOAD_MAX_MEMORY_SIZE = 2 * 1024 * 1024 # 5MB
SIMPLE_JWT = {
'AUTH_HEADER_TYPES': ('JWT',),
}
DJOSER = {
'TOKEN_MODEL': None,
}
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=5),
"REFRESH_TOKEN_LIFETIME": timedelta(days=1),
"AUDIENCE": 'freekake_api',
"ISSUER": 'freekake_api',
}

View File

@ -25,6 +25,7 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('oauth/', include(oauth2_urls)),
path('auth/', include('djoser.urls')),
# path('auth/', include('djoser.urls.jwt')),
path('core/', include('core.urls')),
path('content/', include('content.urls')),