sunscrapers/djoser

"User Delete" endpoint expects DRF token despite `rest_framework_simplejwt` auth backend being set

Opened this issue · 2 comments

As in the title, I've got simple Django app where I use rest_framework_simplejwt. Other flows like i.e. user's creation work flawlessly, although I've encountered an issue with DELETE /users/me/ one, which responds with:

AttributeError at /auth/users/me/
type object 'Token' has no attribute 'objects'
(...)

Which seems to be a token from DRF Token Based Authentication I think?

Please show drf and djoser settings.

Sure, here are all settings related to drf / djoser / simplejwt:

settings.py

INSTALLED_APPS = [
    (...)
    "rest_framework",
    "rest_framework_simplejwt",
    "djoser",
]

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": (
        "rest_framework_simplejwt.authentication.JWTAuthentication",
    )
}

SIMPLE_JWT = {
    "AUTH_HEADER_TYPES": ("JWT",),
}

DOMAIN = "www.myapp.com"
SITE_NAME = "MY APP"
DJOSER = {
    "PASSWORD_RESET_CONFIRM_URL": "#/password/reset/confirm/{uid}/{token}",
    "ACTIVATION_URL": "/activate/{uid}/{token}",
    "SEND_ACTIVATION_EMAIL": True,
    "PASSWORD_RESET_CONFIRM_RETYPE": True,
    "SERIALIZERS": {},
}

urls.py

urlpatterns = [
    (...)
    path("auth/", include("djoser.urls")),
    path("auth/", include("djoser.urls.jwt")),
]