I am trying to get an access token and using the following url to POST the HTTP request and receiving
{
"error":"invalid_request",
"error_description":"Invalid grant_type parameter or parameter missing"
}
error message . No matter what I try. I am posting seconds after receiving the code so I dont think the code could be the failure point.
post ;code=H23sCQmlzsEJSEyhKXj19yb1LWew9MPk&client_id=xyz&client_secret=123
What am I doing wrong?
I am trying to get an access token and using the following url to POST the HTTP request and receiving
{
"error":"invalid_request",
"error_description":"Invalid grant_type parameter or parameter missing"
}
error message . No matter what I try. I am posting seconds after receiving the code so I dont think the code could be the failure point.
post https://api.box./oauth2/token?grant_type=authorization_code&code=H23sCQmlzsEJSEyhKXj19yb1LWew9MPk&client_id=xyz&client_secret=123
What am I doing wrong?
Share edited Jan 10, 2013 at 1:59 Okan Kocyigit 13.5k18 gold badges72 silver badges131 bronze badges asked Jan 10, 2013 at 1:53 Christen MitchellChristen Mitchell 311 silver badge2 bronze badges2 Answers
Reset to default 5I think you might try sending the grant_type=...
in the request body, not as a query string.
Here's the documentation example for that particular request:
curl https://api.box./oauth2/token \
-d 'grant_type=authorization_code&code={your_code}&client_id={your_client_id}&client_secret={your_client_secret}' \
-X POST
I had been having this same problem and John's solution worked. Instead of including the parameters in the url as you do when getting the access code, you need to encode them as POST data.
I'm using the Postman add-in for Chrome and I enter the parameters in the lower Key-Value
fields after clicking the x-www-form-urlencoded
button.