question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

400 error when logging in when using email only mode.

See original GitHub issue

I am trying to set up authentication using django-rest-auth and django-allauth. The user exists in the database and I can login to the django admin site. When I try to login using the rest-auth/login/ endpoint posting email/password, I receive a 400 error with the following response:

{
    "non_field_errors": [
        "Unable to log in with provided credentials."
    ]
}

I followed the instructions here: http://django-allauth.readthedocs.io/en/latest/configuration.html#configuration

In my settings file I have the following:

ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_AUTHENTICATION_METHOD = 'email' 

If I comment out the three lines above and use the same endpoint but add the username it works. It seems to only not work with email only mode.

Thanks for your help!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

6reactions
genomics-geekcommented, Jan 9, 2017

I left out AUTHENTICATION_BACKENDS in settings. That was the issue.

1reaction
SpeciesDecipitcommented, Apr 13, 2019

AUTHENTICATION_BACKENDS

Oh my. @genomics-geek thank you very much, I have spent about 1.5 hours to try to fix this problem. I do not think that moving from JWT to Bearer Token will so long in the new project. Thank you again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a 400 Bad Request Error (Causes and Fixes)
The 400 Bad Request error indicates that the server cannot or process the request due to a client error. Read about the common...
Read more >
Gmail in Chrome only gets a 400 error
Gmail error 400 appears on your web browser if you have multiple accounts and try to sign in. You may face the “Bad...
Read more >
What is HTTP error 400 and how do you fix it? - IT PRO
It's hard not to be unfazed by an HTTP error that tells you little about the problem. That said, fixing a 400 Bad...
Read more >
How to Fix a 400 Bad Request Error: 8 Easy Methods
The HTTP status 400 – bad request indicates that the request sent to the server is invalid or corrupted. Just like other 4xx...
Read more >
Fix Google Chrome Bad Request Error 400
Google Chrome Bad Request error 400 indicates the server could not understand or process the request sent by your browser. What causes bad...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found