1

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.

whoisearth
  • 4,080
  • 13
  • 62
  • 130

1 Answers1

2

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"}

Jeremy Farrell
  • 1,481
  • 14
  • 16
  • That got it thnx! I'm assuming the header with the json is encoded when it passes to get the token? like how when I do Basic Authorization it hashes the username/password. – whoisearth Nov 06 '16 at 13:52
  • Basic authentication does a base 64 encode of your username and password I think. – Jeremy Farrell Nov 06 '16 at 14:08
  • found the following: http://stackoverflow.com/questions/29572707/rest-authorization-username-password-in-authorization-header-vs-json-body Looks like it's neutral but preferred to use the HTTP standard auth. – whoisearth Nov 06 '16 at 16:26