要使用 Firebase 云消息传递,我必须将哪些 API 限制列入白名单?

What API restriction do I have to whitelist in order to use Firebase Cloud Messaging?

我目前在 iOS 带有 flutter 框架的应用程序中使用 Firebase。

由 firebase 创建的默认 Google Cloud API 密钥可以不受限制地访问 APIs,因此我想将其限制为我的应用程序的某些 APIs出于安全原因使用。

然而,在进行 API 限制后,几乎所有与 firebase 相关的组件都可以正常工作,但该应用程序似乎无法获取 Firebase Cloud Messaging Token(例如 FirebaseMessaging.getToken() 调用失败).该应用程序假设检索此令牌并将其发送到后端服务器,以便服务器可以发送 FCM 消息,但是当进行此调用时,它只是挂起一段时间并且 returns 为空。

当我的应用程序密钥可以不受限制地访问 APIs 时,它可以很好地检索 FCM 令牌,但是一旦我限制它,它就无法检索令牌。

我目前已将以下 APIs 列入 Firebase iOS 应用密钥的白名单。

我查看了其他 API 列表,它们似乎与 Firebase 云消息传递根本无关,所以我没有 select 任何其他内容,所以我被卡住了。有没有其他人在尝试限制 Firebase API 密钥时遇到过这个问题?

(我在下面附上了完整的 API 权限列表。)

App Engine Admin API
BigQuery API
BigQuery Storage API
Cloud Build API
Cloud Datastore API
Cloud Debugger API
Cloud Deployment Manager V2 API
Cloud DNS API
Cloud Firestore API
Cloud Functions API
Cloud Logging API
Cloud Messaging
Cloud Monitoring API
Cloud OS Login API
Cloud Pub/Sub API
Cloud Resource Manager API
Cloud Run API
Cloud Runtime Configuration API
Cloud Scheduler API
Cloud Source Repositories API
Cloud SQL
Cloud SQL Admin API
Cloud Storage
Cloud Tasks API
Cloud Testing API
Cloud Trace API
Compute Engine API
Container Registry API
FCM Registration API
Firebase App Distribution API
Firebase Cloud Messaging API
Firebase Dynamic Links API
Firebase Extensions API
Firebase Hosting API
Firebase Installations API
Firebase Management API
Firebase Mods API
Firebase Remote Config API
Firebase Rules API
Google Cloud APIs
Google Cloud Storage JSON API
Google Play Android Developer API
IAM Service Account Credentials API
Identity and Access Management (IAM) API
Identity Toolkit API
Kubernetes Engine API
Legacy Cloud Source Repositories API
Maps Embed API
Maps JavaScript API
Maps SDK for Android
Maps SDK for iOS
Maps Static API
Mobile Crash Reporting API
Service Management API
Service Usage API
Stackdriver API
Street View Publish API
Street View Static API
Token Service API

您必须另外将 Firebase Installations API.

列入白名单

可在此处找到详细信息:
https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/API_KEY_RESTRICTIONS.md