"missing or unknown grant type" message is displayed while requesting for "access Token"


#1

I posted request to get OAuth 2.0 Access Token and Refresh Tokens, But i get the response as below. Could any one solve this problem? . Is there any missing in the request body? I am using Jmeter/ Postman tool.

Request Body:

POST https://api.hubapi.com/oauth/v1/token

POST data:

Request Headers:
Connection: keep-alive
Data: grant_type=authorization_code&client_id=2d7b76c7-fc20-40ee-xxxx-e47ef13530c6&client_secret=216ad59a-xxxx-4c8e-979c-6f920fc572f9& redirect_uri=https://api.hubapi.com/contacts/v1/lists/all/contacts/all?code=c7e3b4b7-xxxx-4912-8347-6a440367801b
Content-Length: 0
Content-Type: application/x-www-form-urlencoded;charset=utf-8

Response Body:

{
"status":"BAD_GRANT_TYPE",
"message":"missing or unknown grant type",
"correlationId":"ddc609b9-a621-4957-95b6-2178e1d44cff",
"requestId":"50453a4e2ccd97553212fdddf3fe2586"
}


#2

Hi @Thejaswi,

That appears fine at a first glance; it does appear that the data isn't formatted correctly, but I'm not sure if that's just a translation error when copying the info into the forums. The data should look like this:

grant_type=authorization_code
&client_id=xxx
&client_secret=xxx
&redirect_uri=https://api.hubapi.com/contacts/v1/lists/all/contacts/all
&code=c7e3b4b7-xxxx-4912-8347-6a440367801b

In your example, it looks like there's a question mark instead of an ampersand before the code value?