Fix “Authorization failed. Error: redirect_uri_mismatch” in Rank Math (Google connection)

Rank Math tries to connect your site to Google Analytics or Search Console, but Google stops the login with Authorization failed. Error: redirect_uri_mismatch. That message means one thing: the URL Google is asked to send you back to does not match what it expects. Follow the steps below to realign your URLs and reconnect cleanly.

Rank Math shows "Authorization failed. Error: redirect_uri_mismatch" when I try to connect Google services. How do I fix this step by step?

Why this error shows up

Rank Math is trying to connect your site to Google Search Console or Analytics using Google OAuth. OAuth is the system Google uses for logins and permissions. Google blocks the login and returns Authorization failed. Error: redirect_uri_mismatch.

In simple terms, Google is saying:

"The URL I am supposed to send you back to is not one of the URLs this app is allowed to use."

That usually comes down to one of these:

  • You moved the site (staging to live, changed domain, switched http/https or www) after first connecting Rank Math.
  • Your WordPress Address (URL) and Site Address (URL) do not match the real URL you are using.
  • You are using a custom Google app (your own client ID and secret) and the Authorized redirect URI there does not match what Rank Math is sending.
  • Less often, a security plugin, proxy, or custom admin URL is rewriting the callback so Google sees a different address.

We will fix the obvious migration and URL issues first, then handle custom app setups, then edge cases.

If you just migrated or changed your site URL

If you recently moved from staging to live, changed domains, or switched http to https, start here. This is the most common pattern for Google plugins that hit redirect_uri_mismatch.

Step 1: Make sure WordPress knows your real URL

  1. In WordPress, go to Settings → General.
  2. Check WordPress Address (URL) and Site Address (URL).
  3. Both should show the current, public URL of your site, including protocol and www or non www. For example:
    • https://example.com (no www)
    • https://www.example.com (with www)
    • https://example.com/blog (if WordPress lives in a subdirectory)
  4. If either field is wrong, fix it and click Save Changes.
  5. Log back in if WordPress asks you to.

Step 2: Remove the old Rank Math app from your Google account

This clears the old pairing so Rank Math can register the correct URL the next time you connect.

  1. In a new tab, open your Google account's third party access page.
  2. Find Rank Math or Rank Math SEO in the list.
  3. Click it, then click Remove access.

Step 3: Reconnect Google services in Rank Math

  1. In WordPress, go to Rank Math SEO → General Settings → Analytics.
  2. Click Reconnect or Connect Google Services.
  3. Choose the correct Google account and allow all requested permissions.
  4. Back on the Analytics screen, pick your Search Console property, Analytics property, and view or data stream.
  5. Click Save Changes.
  6. Wait a minute, reload the page, and confirm that the Authorization failed. Error: redirect_uri_mismatch notice is gone.

If the error no longer appears, you are done. If it is still there, keep going.

If you use your own Google app (client ID and secret)

If you set up a custom Google Cloud OAuth app for Rank Math or a helper plugin, the error usually means the Authorized redirect URI in Google Cloud does not exactly match the URL Rank Math is sending.

Step 4: Copy the redirect URL from your WordPress settings

  1. Open the screen where you entered your Google Client ID and Client secret.
  2. Look for a field or notice labeled Redirect URI, Authorized redirect URL, or similar.
  3. Select that whole URL and copy it, including:
    • Protocol (https:// is required for Google web apps).
    • Domain and subdomain (for example, example.com vs www.example.com).
    • Exact path after the domain, including /wp-admin/ and query string if present.

Step 5: Update Authorized redirect URIs in Google Cloud Console

  1. Go to Google Cloud Console → APIs & Services → Credentials.
  2. Click your OAuth 2.0 Client ID that Rank Math is using.
  3. In the Authorized redirect URIs section, make sure the URL you just copied from WordPress is listed exactly:
    • No missing or extra trailing slash.
    • No stray spaces, quotes, or line breaks.
    • Protocol, domain, and path must all match.
  4. If it is wrong, paste the correct URL, remove outdated ones that point to staging or old domains, and click Save.
  5. Wait a few seconds, then try connecting Rank Math again.

If you are not sure which OAuth client Rank Math uses, check any setup guide you followed when you first created the app and verify you are editing the same project and client ID.

If your URL never changed and you are not using a custom app

If you are still seeing redirect_uri_mismatch even though the site never moved and you are using Rank Math's default Google app, treat it as a URL or environment mismatch.

Step 6: Confirm the URL where the error appears

  1. When the Google error page appears, look at the address bar in your browser.
  2. Make sure the URL starts with https://accounts.google.com/.
  3. In the error details, look for the redirect_uri value Google is complaining about. Check:
    • Does the domain match your live site?
    • Is there an unexpected subdomain, such as staging.example.com or a host's preview URL?
    • Is the path pointing at a custom admin URL or a maintenance page?

If the redirect URI clearly uses an old domain or staging URL, repeat the migration steps above and reconnect.

Step 7: Look for plugin and proxy conflicts

Some tools rewrite admin URLs or proxy traffic in ways that confuse Google.

  1. Temporarily disable plugins that:
    • Hide or rename /wp-admin.
    • Add extra login firewalls or two factor prompts in the admin area.
    • Rewrite URLs or proxy everything through a different path.
  2. If you use a reverse proxy or CDN that rewrites domains, temporarily bypass it and test directly on the origin domain.
  3. Try connecting Rank Math again.

If the error disappears with a specific plugin disabled or with the proxy bypassed, you have found the conflict. Keep that tool disabled for the connection step or consult its docs for an exception rule.

Step 8: Use Rank Math's own connection checks

  1. Go to Rank Math SEO → General Settings → Analytics.
  2. In Advanced mode, click Test Connections.
  3. If you see a red indicator next to Search Console or Analytics, click the corresponding Reconnect link and walk through the Google login again.

If you cannot work out the cause

If none of the steps above fixed it, a few details will make troubleshooting much faster.

Scroll down, click Continue Chat, and send me:

  1. Exactly when the error appears. Is it after you click Connect Google Services, or when you save settings?
  2. Whether your site was ever on a different domain, staging URL, or http instead of https.
  3. Whether you are using a custom client ID and secret, or Rank Math's default Google app.
  4. A screenshot or copy of the full Google error page, including any redirect_uri value shown.

Verification

You know the problem is fixed when:

  • You can connect Rank Math to Google without seeing Authorization failed. Error: redirect_uri_mismatch.
  • In Rank Math SEO → General Settings → Analytics, all services show as connected and Test Connections reports green.
  • The Analytics and Search Console data starts to populate inside Rank Math after data has had time to sync.

Still stuck?

For AI help

Hit Continue Chat below and I will walk you through your exact domain history, Google app setup, and any remaining redirect URI issues until it is resolved.

For expert human help

Scroll down to the contact form below. Enter your name, email, and WordPress needs. Atiba will get back to you as soon as possible.

Need human WordPress help?

WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!