Get access token

oauth

#1

When i get access token, I see this error

BadRequest - {“status”:“MISMATCH_REDIRECT_URI_AUTH_CODE”,“message”:“redirect URI does not match initial auth code URI”,“correlationId”:“38f1c394-81ae-4bc2-acde-56783785194e”,“requestId”:“07dd0b8b6207650f64418f5ceb4a60b5”}

image
ss - redirectUri at the time of receipt of the authorization code
redirectUri - redirectUri at the time of receipt of the access_token

If you see, they are equal.

grant_type=authorization_code&client_id={ConsumerKey}&client_secret={ConsumerSecret}&redirect_uri={redirectUrl}&code={code}


#2

Hi @Hub_Spot,

Can you send me the full request you’re sending, including headers?


#3

Anybody can help me?


#4

Hi @Hub_Spot

From my knowledge if you are using the OAuth and you specify the redirect url in your first request in the browser during the integration of your application you need to provide a page, lets say that this is page A.

In your request to Hubspot you need to point to the same website, that you have specified in the initial request (page A). If you send in the initial request the redirect_url a “localhost”, then if won’t be different on both HubSpot system and your System as it would point to local machine address. (unless it won’t return information that this is not a valid url).

Please try to use both requests (initialization) and your access token request with https://hubspot.com and see if that works.


#5

Hi @H3xas,
Your advice has helped me. I’m really surprised that they don’t use localhost…
Thank you very much!


#6

You’re welcome.
The page https://hubspot.com I advised is just a simple one. The main point is to use twice the same web address.

Cheers mate!