Free for 4 days: connect your Google Business Profile and get every Pro feature. No payment needed.
Chamko AI
Profile optimisation

Google Business Profile OAuth redirect_uri_mismatch: How to Fix the Callback URL

This article focuses on OAuth callback URL configuration in a Google Business Profile integration.

By Chamko Research Team Updated 5 min read

Quick answer

This article focuses on OAuth callback URL configuration in a Google Business Profile integration.

Overview

This article focuses on OAuth callback URL configuration in a Google Business Profile integration.

Overview

The redirect_uri_mismatch error appears when an OAuth authorization request uses a callback URL that does not exactly match an authorized redirect URI configured for the OAuth client. In a Business Profile integration, this can stop an owner from connecting their Google Account even when the client ID looks correct and the API is enabled. The fix is usually a configuration comparison, not a change to the business listing. Check the scheme, hostname, port, path, capitalization where relevant, and trailing slash; make sure the deployed environment uses the intended OAuth client; and test the complete sign-in flow after updating the configuration.

Understand what the redirect URI does

During an OAuth flow, the application sends the user to Google's authorization endpoint and includes a redirect URI. After consent or an error, Google returns the browser to that registered callback. Google checks the redirect URI against the list authorized for the specific OAuth client ID. It is a security boundary: a callback cannot be changed freely at runtime because an attacker could redirect an authorization response to a location they control. The callback URL is not the same as the website's home page, JavaScript origin, API endpoint, or Business Profile URL. Each serves a different role and should be configured in the appropriate field.

Compare the exact strings

Copy the redirect URI used by the running application and compare it with the authorized URI shown in Google Cloud Console for that OAuth client. Check https versus http, the exact hostname, any subdomain, port, path, and final slash. A local callback such as http://localhost:3000/auth/google/callback is different from a production callback on the live domain. A staging URL is also different from production. Reverse proxies can create confusion if the application thinks it is using HTTP internally while the browser-facing URL is HTTPS. Do not solve that by adding random callback variants; identify the canonical external URL and configure the app to use it consistently.

Verify the OAuth client and environment

Multiple Cloud projects or OAuth clients are a frequent source of mismatch. A developer may add the production callback to one client while the deployed app still uses a client ID from staging. Inspect the actual client ID in the authorization request or safe application configuration, then open the matching client in Cloud Console. Keep development, staging, and production settings separated. Use environment variables or a secret manager instead of hard-coding client IDs and callback URLs throughout the codebase. When a deployment changes domains, update the authorized URI and deployment configuration together as one release task.

Check framework and proxy behaviour

Framework defaults may build a callback from request headers, while a load balancer or reverse proxy changes those headers. If the app generates an unexpected callback, log the final redirect URI before sending the user to Google. Do not log access tokens, authorization codes, or client secrets. Configure trusted proxy handling correctly and set a stable public base URL where supported. Ensure the callback route exists and is registered with the same path that the application sends. If the application uses separate routes for sign-in and callback, register the callback route, not the route that starts authentication.

Avoid deprecated flows and fragile fixes

Google's OAuth documentation notes that the old out-of-band flow is no longer supported. If an older tutorial instructs the app to display a code for manual copy-and-paste, migrate to a currently supported OAuth flow rather than trying to register an obsolete callback. Do not disable redirect validation, use a callback owned by someone else, or pass the authorization code through an untrusted URL. Such shortcuts weaken account security and can expose access to business data. The correct solution is to use a supported flow and an exact, authorized callback.

A controlled test procedure

First reproduce the error with the current environment. Record the OAuth client identifier and the exact redirect URI, excluding secrets. Next, compare the callback with the authorized list for that same client. Correct one mismatch, deploy the configuration, and repeat the sign-in flow in a clean browser session. Verify that the browser returns to the intended callback and that the server exchanges the authorization code successfully. Test production and staging separately. If a browser cache or old deployment is involved, verify the live version rather than assuming a local configuration change reached the server.

Example scenario

A dashboard works locally but fails after deployment. The developer registered https://app.example.com/auth/google/callback in Cloud Console, while production constructs https://www.app.example.com/auth/google/callback/. The extra subdomain and trailing slash make the strings different. The team chooses one canonical production URL, updates the application configuration and authorized redirect list, then tests the deployed flow. It does not modify the Business Profile, request a quota increase, or ask the owner to reverify the business because the failure is in OAuth callback configuration.

Frequently asked questions

Does this error mean the Business Profile is suspended? No; it occurs during OAuth authorization before the integration can reliably manage the profile. Can the website homepage be used as the callback? Only if the application is designed for that flow and the URL is registered correctly; a dedicated callback route is usually clearer. Does enabling the API fix the mismatch? No; API enablement and OAuth redirect configuration are separate. Should all possible URLs be added? Add only legitimate callback URLs used by the app. Is a trailing slash important? It can be, because the callback must match the authorized value exactly.

Conclusion and next steps

Treat redirect_uri_mismatch as a strict OAuth configuration error. Capture the exact callback generated by the running application, compare it against the authorized URI for the client actually in use, and fix the environment or proxy configuration that created the difference. Use a supported OAuth flow and test the complete callback path after deployment. Leave the business listing untouched unless a separate profile issue is independently confirmed.

Release checklist

Before shipping an OAuth change, verify the callback on local, staging, and production environments; confirm the correct client ID is loaded; check HTTPS and canonical host handling; validate the callback route; and run one full authorization round trip. Add a deployment check that displays the selected environment and public callback URL to an administrator without exposing secrets. This makes a future domain migration easier to audit and reduces the chance that a working staging setup masks a broken production configuration.

Keep reading