"missing or unknown grant type" error during /oauth/v1/token POST request


I was converting to oauth2 and was able to get the “code” after user sign-in. However when I made POST request to /oauth/v1/token to get the tokens by the “code”, I ran into the following HTTP 400 error:

{“error”:“invalid_request”,“error_description”:“missing or unknown grant type”}

Below is my POST body/payload (scrambled):


I tried rearranged the order of the parameters in the payload, but it made no difference. I’m pretty sure grant_type=authorization_code the same I copied from doc (http://developers.hubspot.com/docs/methods/oauth2/get-access-and-refresh-tokens). But it still complains it’s missing/invalid.

Did I miss anything? Thanks!


Hi @coffeeocean,

From what I can tell, the payload looks correct.

What is the full URL that you are POSTing to?

https://api.hubapi.com/oauth/v1/token (notice that for oAuth the base URL is: https://api.hubapi.com and not https://app.hubspot.com)

The only other thing that I can think of would be a problem with your app permissions.


I indeed posted to the right domain. Full URL is: https://api.hubapi.com/oauth/v1/token.

What do you mean by app permissions? Did you mean “scope”, which I set to be “scope=contacts” when redirecting the user to sign in at https://app.hubspot.com/oauth/authorize.



Hi @coffeeocean

As @Stephen_Yager mentioned, the payload does look correct, but you should only be getting that error message for problems specific to the grant_type field (any problems with the other fields return errors specific to the field with the problem).

If you’re still seeing that error, can you message me directly and send me the full payload that you’re using so I can take a look at your specific data?