The “BAD_REDIRECT_URI” error typically occurs when there is an issue with the redirect URI specified in your OAuth authorization request.
Here are a few things you can check and consider to resolve the “BAD_REDIRECT_URI” error:
Verify the redirect URI: Ensure that the redirect URI you have provided in the authorization request matches the one registered in your OAuth client settings. The redirect URI must be an exact match, including the protocol (http:// or https://), domain, and path.
Add the redirect URI to your client settings: Make sure that the redirect URI you are using is added to the list of allowed redirect URIs in your OAuth client settings. Some platforms, like HubSpot, require you to register and allowlist the redirect URIs that your application will use.
Check for URL encoding issues: If your redirect URI contains any special characters or query parameters, ensure that they are properly URL encoded. Incorrect encoding can cause the URI to be considered invalid.
Use a valid and accessible redirect URI: Ensure that the redirect URI is valid and points to a live and accessible page on your website. Verify that the URL is correct and that the page is publicly accessible.
Confirm the authorization workflow: Check if you are following the correct authorization workflow for the specific OAuth provider you are integrating with. Some providers may have additional requirements or restrictions regarding redirect URIs.
Hope this will helps you out. Please mark it as Solution Accepted & Upvote to help other Community member.
Thanks!
To add the redirect URI to your client settings in HubSpot, follow these steps:
Log in to your HubSpot account and navigate to the “Settings” menu.
In the left sidebar, scroll down and click on “API Keys.”
On the API Keys page, locate the OAuth 2.0 section and click on the “Create an app” button.
Fill in the necessary details for your app, such as the name, description, and logo. You can also specify the scopes and permissions required for your app.
In the “Redirect URL” field, enter the URL where you want the user to be redirected after completing the authorization process. This URL should be a page on your website that can handle the authorization callback.
Click on the “Save” button to save your app settings.