BAD_GRANT_TYPE on cURL

SOLVE
Occasional Contributor

I am having trouble getting my access token when trying to authenticate using OAuth 2.0.

After retrieving a code using a callback URI, I am attempting to make a cURL requst as follows:

 

curl \
-H ‘Content-Type:application/x-www-form-urlencoded’ \
-X POST \
-d ‘{
"grant_type":"authorization_code”,\ ”client_id":<client_id>,\ "client_secret":<client_id>,\ ”redirect_uri":<my_url>,\ “code":<code>}’\ https://api.hubapi.com/oauth/v1/token

However, I get the following error:

{
"status":"BAD_GRANT_TYPE",
"message":"missing or unknown grant type",
"correlationId":"5e63d42e-46c5-4b03-8168-8b3cd82794e1",
"requestId":"b732e441fb093ad8b6d76b9d30a21677"
}

I have tried adding "charset=utf-8" and changing the header type to "application/json" but neither of those solve the issue.

 

Thank you!

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Occasional Contributor

I figured out the issue. I was writing out my cURL requests into a notepad application, and it was autocorrecting my single quotes from straight quotes ( ' ) into curvy quotes ( ’ ) and this was causing the command to be mis-interpreted.

1 Reply 1
Occasional Contributor

I figured out the issue. I was writing out my cURL requests into a notepad application, and it was autocorrecting my single quotes from straight quotes ( ' ) into curvy quotes ( ’ ) and this was causing the command to be mis-interpreted.