whoisearth
whoisearth

Reputation: 4170

django JWT asking for username/password

I can successfully connect via CURL using the example posted in their documentation here:

http://getblimp.github.io/django-rest-framework-jwt/#usage

The problem comes from trying to use Postman. I set the authorization to Basic and put in my username/password and I get a 400 response with the following json:

{
  "username": [
    "This field is required."
  ],
  "password": [
    "This field is required."
  ]
}

I'm not sure if I'm missing something obvious.

Upvotes: 1

Views: 595

Answers (1)

Jeremy Farrell
Jeremy Farrell

Reputation: 1491

Instead of passing the username and password as part of the header send it as data in the body instead. Here's an example of doing this with jQuery: http://jpadilla.com/post/73791304724/auth-with-json-web-tokens

Taking from the example the data you pass in the body should look like this: { username: "admin", password: "abc123"}

Upvotes: 2

Related Questions