Error getting OAuth 2.0 Access Token


#1

Hi guys, I’m getting an error when trying get my OAuth access token. I’m able to successfully authorize my app and get a code using the redirect URL, but when I try to use that code to get an access token, I’m getting error: “redirect URI does not match initial auth code URI”

I’ve verified it’s a fresh code and copied in the format in the access token article so not sure what’s going on? Here’s my curl command:

curl -X POST --header “Content-Type:application/x-www-form-urlencoded;charset=utf-8” --data “grant_type=authorization_code&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&redirect_uri=http://www.hubspot.com/&code=CODE_FROM_URL_PARAMETER” ‘https://api.hubapi.com/oauth/v1/token


#2

Hi @samesame

I’m not seeing any issues with this testing this just now. Are you using http://www.hubspot.com/ as the redirect_uri in the initial authorize URL, or do you have another URL from your app?


#3

Thanks for the quick help, much appreciated!

Yeah I was using http://www.hubspot.com/ as the redirect_uri in the initial authorize URL. I tried using another URL too in case it made a difference but nope.

Any settings you’d suggest changing/checking?