Using Django OAuth Toolkit, I have authorization_grant_type set to password 
and skip_authorization set to true. I am able to generate tokens and 
refresh tokens using curl without an issue using the following command:

    curl -X POST -d 
"grant_type=password&username=username&password=password" 
http://p6ge67ihXcwECuy7Z7iomyv16VlEk4uX6B886UWl:NZK5WUWsdb1oI1aAXAy3EOLx6zbXBrtVEIUoI7pK9ZLpwkMTvIcq3FMycHklGjJazHj4TguPPvpEL1JNmL6uZz594DjNk99nKu6Uq4Z66mM26AWD63D9WO449exUjYq3@localhost:8000/o/token/

But when I try substituting this command with a POST and invoke that POST 
from a Django view, I get the following:

    <Response [401]>
    Unauthorized: /o/token/

Any clue why this happening? My POST code is as follows:

    data = {
    'grant_type': 'password',
    'username': 'username',
    'password': 'password'
    }

    response = 
 
requests.post('http://p6ge67ihXcwECuy7Z7iomyv16VlEk4uX6B886UWl:NZK5WUWsdb1oI1aAXAy3EOLx6zbXBrtVEIUoI7pK9ZLpwkMTvIcq3FMycHklGjJazHj4TguPPvpEL1JNmL6uZz594DjNk99nKu6Uq4Z66mM26AWD63D9WO449exUjYq3@localhost:8000/o/token/',
 
data=data)

What am I missing? Any help would be greatly appreciated. Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to