创建Google API OAuth2.0令牌遇redirect_uri_mismatch错误求助
Fixing OAuth2
redirect_uri_mismatch Error for Google AdWords API Hey Kareem, let's work through this redirect_uri_mismatch error—it's one of the most common gotchas with Google's OAuth setup, so we'll get this sorted for you. Here's a step-by-step breakdown of the key checks and fixes:
1. Verify Your OAuth Client Settings in Google Cloud Console
- First, make sure you're using the correct OAuth Client ID for your AdWords project. It's easy to mix up clients from different projects or confuse Web/Desktop/Mobile client types—stick to the one you created specifically for this integration.
- Add the OAuth Playground's redirect URI to your client's authorized list:
- Navigate to your project in Cloud Console → Go to APIs & Services → Credentials
- Find your OAuth Client ID, click "Edit"
- In the "Authorized redirect URIs" section, add the exact callback URL you're using in the Playground. For the default Playground setup, this is
https://developers.google.com/oauthplayground - Save the changes and wait 1-2 minutes—Google's settings can take a moment to propagate.
2. Double-Check OAuth 2.0 Playground Configuration
- Open the Playground and click the gear icon in the top-right corner to access settings:
- Ensure the "Use your own OAuth credentials" option is checked, then input your Cloud Console client ID and client key exactly as they appear.
- Confirm the "Authorization callback URL" matches what you added in Cloud Console—even a tiny typo (like missing an 's' in 'https' or a trailing slash) will trigger the mismatch error.
3. Validate Your Requested Scopes
- While the redirect mismatch is the direct issue, make sure you're requesting the correct AdWords API scope:
https://www.googleapis.com/auth/adwords. Using an incorrect scope can sometimes cause unexpected authorization flow issues, so cross-reference this with the official docs to be safe.
4. Clear Browser Cache & Session Data
- Old cached OAuth sessions or cookies can interfere with the redirect validation. Clear your browser's cache for Google-related sites, log out of all Google accounts, then re-open the Playground and try again with your target account.
5. Confirm OAuth Consent Screen Status
- If your Cloud Console project is set to External and is still in testing mode, ensure your Google account is added to the "Test users" list under APIs & Services → OAuth consent screen. Without this, you might hit hidden permission blocks that manifest as redirect errors.
If you've gone through all these steps and still see the error, triple-check every character in your redirect URIs—they need to be identical in both Cloud Console and the Playground. Even subtle differences like capitalization or extra spaces will break the validation.
内容的提问来源于stack exchange,提问作者Kareem
相关产品推荐
相关产品推荐

