3

I'm using the Django Rest Framework with django-oauth-toolkit, When I make a request on POSTMAN, with this body it works fine,

{
    "username":"username",
    "password":"password",
    "client_id":"something",
    "client_secret":"somethingelse",
    "grant_type":"password"
}

When I make the same request using requests, I get

unsupported_grant_type

This is my request code,

data = {"username": username,
        "password": password,
        "client_id": client_id,
        "client_secret": client_secret,
        "grant_type": "password"}

r = requests.post(url, data=data)

I'm using the string "password" as grant_type. It works in Postman, just doesn't work in code.

halfer
  • 19,824
  • 17
  • 99
  • 186
Melissa Stewart
  • 3,483
  • 11
  • 49
  • 88

0 Answers0