Tivix / django-rest-auth

This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
www.tivix.com
MIT License
2.41k stars 661 forks source link

/user/ endpoint "Credentials not provided" no matter what #557

Closed SHxKM closed 5 years ago

SHxKM commented 5 years ago

I was thinking that maybe I'm doing something wrong with the frontend but no matter how I try to access accounts/auth/user and pass the user's token, I get a 401 unauthorized error.

I've tried using postman and send the token in several ways and under several names, but nothing worked.

Possibly relevant snippets from settings.py:


AUTHENTICATION_BACKENDS = (
    "allauth.account.auth_backends.AuthenticationBackend",
    "django.contrib.auth.backends.ModelBackend",
)

ACCOUNT_AUTHENTICATION_METHOD = ("username_email")
ACCOUNT_EMAIL_REQUIRED = False
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = False

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        # 'rest_framework.authentication.SessionAuthentication',
        'rest_framework.authentication.TokenAuthentication',
    ),
}