feat: add DRF token authentication support
Add `rest_framework.authtoken` to installed apps and configure `TokenAuthentication` as an authentication class in the REST framework settings, enabling token-based API authentication alongside existing session and basic authentication methods.
This commit is contained in:
@@ -50,6 +50,7 @@ INSTALLED_APPS = [
|
|||||||
"django.contrib.humanize",
|
"django.contrib.humanize",
|
||||||
# Third-party
|
# Third-party
|
||||||
"rest_framework",
|
"rest_framework",
|
||||||
|
"rest_framework.authtoken",
|
||||||
"storages",
|
"storages",
|
||||||
"django_neomodel",
|
"django_neomodel",
|
||||||
"django_prometheus",
|
"django_prometheus",
|
||||||
@@ -235,6 +236,7 @@ EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
|
|||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
"DEFAULT_AUTHENTICATION_CLASSES": [
|
"DEFAULT_AUTHENTICATION_CLASSES": [
|
||||||
"rest_framework.authentication.SessionAuthentication",
|
"rest_framework.authentication.SessionAuthentication",
|
||||||
|
"rest_framework.authentication.TokenAuthentication",
|
||||||
"rest_framework.authentication.BasicAuthentication",
|
"rest_framework.authentication.BasicAuthentication",
|
||||||
],
|
],
|
||||||
"DEFAULT_PERMISSION_CLASSES": [
|
"DEFAULT_PERMISSION_CLASSES": [
|
||||||
|
|||||||
Reference in New Issue
Block a user