重要事項:自
2024 年 5 月 1 日起,針對使用常用 SDK (包括 GoogleSignIn-iOS) 的 iOS 應用程式,Apple
規定隱私權資訊清單和簽名。請在 2024 年 5 月 1 日前升級至 GoogleSignIn-iOS 7.1.0 以上版本。按照
升級指南操作。
監控 App Check 要求指標
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在應用程式中加入 App Check 程式庫後,但啟用 App Check 強制執行功能前,請先確認啟用該功能不會中斷現有合法使用者的服務。
您可以使用應用程式檢查要求指標,做為這項決策的重要工具。您可以在 Google API Console 或 Firebase 控制台中監控 App Check 指標。
在 Google API Console中監控指標
如要查看 iOS OAuth 用戶端的指標,請前往「憑證」頁面,然後點選用戶端進入編輯檢視畫面。您會在「Google Identity for iOS」部分下方的頁面右側,看到相關指標。這些指標會顯示 App Check 要求指標。這些指標包括下列資訊:
-
已驗證的要求數:具備有效 App Check 權杖的要求。啟用 App Check 強制執行功能後,只有這類要求會成功。
-
未經驗證的要求數量:可能過時的用戶端要求 - 缺少 App Check 權杖的要求;這些要求可能來自不含 App Check 實作項目的舊版應用程式。
-
未經驗證的要求數量:來源未知的要求 - 不具備 App Check 權杖的要求,且看起來不像是來自您的應用程式。
-
未經驗證的要求數:無效要求 - 具備無效 App Check 權杖的要求,可能來自模擬環境,或是試圖冒用您應用程式的偽造用戶端。
在 Firebase 控制台中監控指標
您可以查看專案的整體指標,或個別 OAuth 用戶端的指標:
要求指標分為四類:
「已驗證」要求是指具備有效 App Check 權杖的要求。啟用 App Check 強制執行後,只有這類要求會成功。
過時的用戶端要求是指缺少 App Check 權杖的要求。這些要求可能來自舊版 Firebase SDK,也就是應用程式採用 App Check 前的版本。
來源不明的要求是指不具備 App Check 權杖,且看起來不像是來自 Firebase SDK 的要求。這些要求可能是使用遭竊的 API 金鑰所發出,也可能是未透過 Firebase SDK 發出的偽造要求。
無效要求是指具備無效 App Check 權杖的要求,可能來自模擬環境,或是試圖冒用您應用程式的偽造用戶端。
應用程式的這些類別分布情況,應做為您決定是否啟用強制執行的依據。以下提供部分準則:
如果近期幾乎所有要求都來自已驗證的用戶端,建議啟用強制執行功能,開始保護驗證端點。
如果近期有大量要求來自可能過時的用戶端,為避免影響使用者,建議您等待更多使用者更新應用程式,再啟用強制執行。對已發布的應用程式強制執行 App Check,會導致未整合 App Check SDK 的舊版應用程式無法運作。
如果應用程式尚未推出,您應立即啟用應用程式檢查強制執行功能,因為目前沒有任何過時的用戶端正在使用。
後續步驟
瞭解 App Check 對使用者的影響後,即可啟用 App Check 強制執行功能。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eBefore enforcing App Check, monitor its request metrics to understand its potential impact on existing users, particularly those using older app versions.\u003c/p\u003e\n"],["\u003cp\u003eApp Check metrics categorize requests into verified, outdated client, unknown origin, and invalid, helping you assess the risk of disrupting legitimate users.\u003c/p\u003e\n"],["\u003cp\u003eIf most requests are verified, consider enabling enforcement; if significant outdated client requests exist, wait for more users to update their app first.\u003c/p\u003e\n"],["\u003cp\u003eFor newly launched apps without existing users, enable App Check enforcement immediately to ensure security from the start.\u003c/p\u003e\n"],["\u003cp\u003eUse the Google API Console or Firebase Console to monitor App Check metrics and make informed decisions about enforcement timing.\u003c/p\u003e\n"]]],[],null,["After you add the App Check library to your app, but before you enable\nApp Check enforcement, you should make sure that doing so won't disrupt your\nexisting legitimate users.\n\nAn important tool you can use to make this decision are App Check\nrequest metrics. You can monitor App Check metrics in the\n[Google API Console](#monitor_metrics_in_the_google_cloud_console) or the [Firebase Console](#monitor_metrics_in_the_firebase_console).\n\nMonitor Metrics in the Google API Console\n\nTo view metrics for your iOS OAuth client, navigate to the edit view of the\nclient in the [Credentials page](https://console.cloud.google.com/apis/credentials). There, you will see metrics to the\nright of the page under the **Google Identity for iOS** section. These metrics\nwill show you your App Check request metrics. The metrics include the\nfollowing information:\n\n- **Number of verified requests** - requests that have a valid App Check token. After you enable App Check enforcement, only requests in this category will succeed.\n- **Number of unverified requests: likely outdated client requests** - requests missing an App Check token; these request may be from an older version of your app that doesn't include an App Check implementation.\n- **Number of unverified requests: unknown origin requests** - requests missing an App Check token that don't look like they are coming from your app.\n- **Number of unverified requests: invalid requests** - requests with an invalid App Check token, which may be from an inauthentic client attempting to impersonate your app, or from emulated environments.\n\nMonitor Metrics in the Firebase Console\n\nYou can view metrics for your projects as a whole, or\nfor individual OAuth clients:\n\n- To view the App Check request metrics for your project, open the\n [App Check](https://console.firebase.google.com/project/_/appcheck) section of the Firebase console and expand the\n **Google Identity for iOS** section. For example:\n\n- To view the App Check request metrics for a specific OAuth client, open the\n [OAuth clients](https://console.firebase.google.com/project/_/appcheck/products/oauth) page of the Firebase console and\n expand the section corresponding to the client.\n\nThe request metrics are broken down into four categories:\n\n- **Verified** requests are those that have a valid App Check token. After\n you enable App Check enforcement, only requests in this category will\n succeed.\n\n- **Outdated client** requests are those that are missing an App Check\n token. These requests might be from an older version of the Firebase SDK\n before App Check was included in the app.\n\n- **Unknown origin** requests are those that are missing an App Check token,\n and don't look like they come from the Firebase SDK. These might be from\n requests made with stolen API keys or forged requests made without the\n Firebase SDK.\n\n- **Invalid** requests are those that have an invalid\n App Check token, which might be from an inauthentic client attempting to\n impersonate your app, or from emulated environments.\n\nThe distribution of these categories for your app should inform when you decide\nto enable enforcement. Here are some guidelines:\n\n- If almost all of the recent requests are from verified clients, consider\n enabling enforcement to start protecting your auth endpoints.\n\n- If a significant portion of the recent requests are from likely-outdated\n clients, to avoid disrupting users, consider waiting for more users to update\n your app before enabling enforcement. Enforcing App Check on a released\n app will break prior app versions that are not integrated with the\n App Check SDK.\n\n- If your app hasn't launched yet, you should enable App Check enforcement\n immediately, since there aren't any outdated clients in use.\n\nNext steps\n\nWhen you understand how App Check will affect your users and you're ready to\nproceed, you can [enable App Check enforcement](/identity/sign-in/ios/appcheck/enable-enforcement)."]]