Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lukaszsi opened this issue Jun 17, 2024 · 2 comments

Comments

@lukaszsi
Copy link

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?

@tomwojcik
Copy link
Contributor

Please show drf and djoser settings.

@lukaszsi
Copy link
Author

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")),
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants