'MISMATCH_REDIRECT_URI_AUTH_CODE' - redirect URI does not match initial auth code URI

I am trying to get the access token and refresh token for my test app but I am getting - “‘MISMATCH_REDIRECT_URI_AUTH_CODE’ - redirect URI does not match initial auth code URI”.

This the code I am using to make the request:

full_URL = ‘https://app.hubspot.com/oauth/authorize?client_id=CLIENTID&redirect_uri=https://hubspot.com&scope=contacts%20content%20automation%20oauth’

REDIRECT_URI = ‘https://www.hubspot.com/’

token_url = ‘https://api.hubapi.com/oauth/v1/token’
headers = {‘content-type’: ‘application/x-www-form-urlencoded’,
‘accept’: ‘application/json’}
form = {‘grant_type’:‘authorization_code’,
‘client_id’:CLIENT_ID,
‘client_secret’: CLIENT_SECRET,
‘redirect_uri’:REDIRECT_URI,
‘code’:authorisation_code}

I am using the correct Redirect URI (https://www.hubspot.com/) still getting this error, I can’t figure out what’s the reason for this error.

@ShaanBisht

Is this issue still happening?

@himanshurauthan , any thoughts?

Hi everyone! :waving_hand:

Just adding a quick clarification for anyone coming across this thread.

Looking at the original code, the issue appears to be a mismatch between the redirect URIs:

  • Authorization request: https://hubspot.com

  • Token request: https://www.hubspot.com/

These URLs are different, which explains the MISMATCH_REDIRECT_URI_AUTH_CODE error.

To resolve this, make sure you’re using the same redirect URI in both requests, and that it’s configured in your app’s OAuth settings.

One additional update: HubSpot now recommends using the OAuth v3 token endpoint (POST /oauth/v3/token) for new integrations.

You can find more details in the HubSpot OAuth documentation: Working with OAuth - HubSpot docs

Hope this helps!


Thank you @dennisedson,

Hello @ShaanBisht,

The main issue is the redirect URI mismatch. Your authorization request uses https://hubspot.com, while your token request uses https://www.hubspot.com/. Both requests must use the same redirect URI.

Hopefully, it will work.

Regards,

Moderator Note: this post was reviewed for relevancy and optimized for clarity on October 23, 2026. Thank you for your contributions to the HubSpot Community!

Hi @ShaanBisht ,

Configure your app’s callback URL in its OAuth settings and ensure the same URL is used in both the authorization and token requests.

Example of App Redirect URL in screen shot : Screenshot by Lightshot

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.

Moderator Note: this post was reviewed for relevancy and optimized for clarity on October 23, 2026. Thank you for your contributions to the HubSpot Community!