6

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

Update

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.

4
  • Have you checked here? Commented Jan 18, 2017 at 12:39
  • @Fian just checked all of the conditions are true as mentioned at that answer. Commented Jan 18, 2017 at 12:44
  • Do you use valid email? You can try to debug it here. Commented Jan 19, 2017 at 10:55
  • same problem here, any solution found? Commented Apr 7, 2017 at 4:32

1 Answer 1

16

You need to add these backends to settings.py file

AUTHENTICATION_BACKENDS = (
   "django.contrib.auth.backends.ModelBackend",
   "allauth.account.auth_backends.AuthenticationBackend"
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.