Aryan VR
Aryan VR

Reputation: 369

"error": "invalid_client" while using Django OAuth toolkit

I was following the steps mentioned in the documentation for django rest framework. I'm not able to proceed from step 4. As mentioned in the documentation,

curl -X POST -d "grant_type=password&username=<user_name>&password=<password>" -u"<client_id>:<client_secret>" http://localhost:8000/o/token/

I have changed the above variables with my values.

curl -X POST -d "grant_type=password&username=admin&password=admin123" -u "5hKeHNtF3EKy3uCpJqaAe3mU2bGZTgJhsKKxIuAQ:pbkdf2_sha256$390000$VFcCOjIZkBFObellddDgKA$DXovC1UiuxRQ0KN/lARIdQmXcj8dnoJofkznmkkqsZY=" http://localhost:8000/o/token/

I tried to import the curl on postman and Im getting this error enter image description here

Then I tried running the curl on Insomnia testing tool, and I got the request configured as in the screenshot. enter image description hereenter image description here

Then I click send and I got an error enter image description here

SO i changed 'Content-Type' to 'Form URL Encoded' enter image description here

Now I'm geting an error

{
"error": "invalid_client"
}

I tried running the curl in shell also, and I'm getting an invalid syntax error enter image description here

I'm stuck with this and don't know how to proceed with this. Please lend me a hand.

Thanks in advance...

Upvotes: 2

Views: 1028

Answers (1)

Aryan VR
Aryan VR

Reputation: 369

I was using the hashed value for client_secret instead of the actual value.

How to get actual client_secret actual value?

Answer: While creating new application, copy the Client secret before saving the values enter image description here

https://github.com/jazzband/django-oauth-toolkit/issues/1193

Upvotes: 3

Related Questions