I wanted a simple api authentication route using django-rest-framework
and 'django-rest-auth`. The register part is working fine as confirmed by the default django admin console and i can also see the users. Unluckily the api authentication keeps on returning me with error
{
"non_field_errors": [
"Unable to log in with provided credentials."
]
}
Currently the configuration that i have for my allauth
is as follows
# all-auth configuration
ACCOUNT_EMAIL_REQUIRED=True
ACCOUNT_AUTHENTICATION_METHOD="email"
ACCOUNT_USERNAME_REQUIRED=False
ACCOUNT_EMAIL_VERIFICATION="none"
ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE=False
# CORS Configuration
CORS_ORIGIN_ALLOW_ALL=True
I am unsure what part I am missing. Please guide me in the right direction. There are no errors and the response code is 400. The credentials are correct as verified from django admin panel. Thanks in advance
The problem is somewhat with email. I commented the configuration out and tried to generate a token with username and password. That works without any error.
You need to add these backends to settings.py file
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend"
)