3

By default when credentials are wrong, DRF-JWT return a response with 400 status. Why is it like that? When users don't provide correct login information, bad request log gets written in the browser's console. So I handle the error at the front but still it is not nice to have a console error message. So how can I override the JWT to not raise a 400, instead return success, what is the correct way to do it?

Ali Ankarali
  • 2,761
  • 3
  • 18
  • 30

1 Answers1

2

In case of bad login credentials, your server should return HTTP 401 or 400 error. More about that:

4XX stands for client-side errors. Bad credentials is the example of that case. There is nothing wrong with console error message resulted from bad request.

Community
  • 1
  • 1
prokaktus
  • 582
  • 5
  • 12