You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Fit API授权同意页面无限加载问题求助

I’ve run into similar blank OAuth consent screen issues with Google APIs before—let’s walk through the most likely fixes for your setup:

1. Missing or Incorrect OAuth Scopes

The blank screen often pops up when your OAuth consent page doesn’t include the exact scopes the Fitness API requires. For step data, you need at minimum the https://www.googleapis.com/auth/fitness.activity.read scope.

  • Go to your GCP Console → APIs & Services → OAuth consent screen
  • Scroll to the Authorized scopes section and verify all necessary Fitness API scopes are listed. If not, click Add or remove scopes, search for the Fitness API, and select the appropriate read/write scopes for your use case.
  • Note: For production environments, non-sensitive scopes should auto-approve, but double-check none are marked as requiring verification (which would block access until approved).

2. SHA-1 Fingerprint Mismatch (Even if You Think It’s Correct)

It’s shockingly easy to copy a truncated or typo-ridden SHA-1. Let’s re-verify:

  • For debug builds: Run this command in your terminal:
    keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
    
  • For release builds: Use your app’s signing keystore and run the same command with your keystore path and credentials.
  • Compare the full 40-character SHA-1 string (no spaces) with what’s in your GCP OAuth 2.0 Client ID for Android. Even one wrong character breaks the flow.

3. Fitness API Isn’t Enabled in GCP

This is a classic oversight:

  • Go to GCP Console → APIs & Services → Library
  • Search for Fitness API and confirm it’s marked as Enabled. If not, click Enable and wait 5-10 minutes for the change to propagate.

If your consent screen is set to production but hasn’t been verified by Google (for external users), it might fail to load properly:

  • Check the OAuth consent screen page in GCP: If there’s a pending verification request or rejection notice, that’s the issue.
  • As a test, switch the consent screen back to Testing mode, add your Google account as a test user, and try the authorization flow again. If it works here, the problem is tied to production verification.

5. Bundle ID (Application ID) Mismatch

Double-check that the Bundle ID in your GCP Client ID exactly matches the applicationId in your Android app’s module-level build.gradle file. Case sensitivity matters—even a lowercase/uppercase difference will cause failures.

6. Google Play App Signing Impact (If You’re Using It)

If your app is published to Google Play (even for internal testing) and you’ve enabled Google Play App Signing, Google replaces your signing key with their own. You’ll need to add their SHA-1 fingerprint to your GCP Client ID:

  • Go to Google Play Console → Your App → Setup → App signing
  • Copy the SHA-1 certificate fingerprint under App signing key certificate and add it to your GCP OAuth 2.0 Client ID’s SHA-1 fingerprints list.

If none of these fix the issue, enable verbose logging in your Fit SDK authorization callback. Add something like:

Log.d("FitAuthDebug", "Auth response: " + response.toString());

This might reveal hidden error messages that aren’t showing up in regular logs.

内容的提问来源于stack exchange,提问作者HeadInTheClouds

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 07:49:07