我更新了 Firebase for Web 应用程序的 Firebase SDK。
由于更新我的应用程序不再启动并引发以下错误:
知道发生了什么吗?
Uncaught (in promise)
FirebaseError: Installations: Create Installation request failed with error "403 PERMISSION_DENIED: Requests to this API firebaseinstallations.googleapis.com method google.firebase.installations.v1.FirebaseInstallationsService.CreateInstallation are disabled." (安装/请求失败)。
And*_*iep 91
事实证明,新版本的 Firebase SDK 依赖于新的内部基础设施服务,称为 FIS(Firebase 安装服务),用于定位标识符(“FID”或“Instance-ID”)。
如果您对应用程序中使用的 API 密钥使用 API 密钥限制,则必须扩展这些限制以允许使用 firebaseinstallations.googleapis.com 上的新 Firebase 安装服务。
要允许您的 API 密钥与新的Firebase Installations API一起使用,请执行以下操作:
APIs & Services->CredentialsEdit API key有问题的 API 密钥API restrictionsFirebase Installations APISave注意:如果您在API列表中找不到Firebase Installations API,您可能首先必须为您的项目启用该 API(要这样做,请单击此处)。
注意:如果您不确定您的应用程序中使用了哪个 API 密钥,您可以检查每个 API 密钥的 Firebase 安装 API的使用数量。
注意: 通过检查您是否可以在Firebase 安装 API 请求指标页面上看到成功请求增加来验证您的修复。200
测试您的配置是否适用于以下 CURL 命令:
api_key=<YOUR_API_KEY>;
project_identifier=<YOUR_PROJECT_ID>;
app_id=<YOUR_FIREBASE_APP_ID_SIMILAR_TO_1:12345678:android:00000aaaaaaaa>;
curl -H "content-type: application/json" -d "{appId: '$app_id', sdkVersion: 't:1'}" https://firebaseinstallations.googleapis.com/v1/projects/$project_identifier/installations/?key=$api_key;
Run Code Online (Sandbox Code Playgroud)
如果您的 API 密钥使用应用程序限制,则必须使用标识您的应用程序的相应 HTTP 标头扩展您的 CURL 请求:
-H "x-android-package: com.rayo.example.app" -H "x-android-cert: 1234567890ABCDEF1234567890ABCDEFAABBCCDD"-H "x-ios-bundle-identifier: com.rayo.example.app"-H "Referer: https://www.your.webapp.com/page?p=1"| 归档时间: |
|
| 查看次数: |
14948 次 |
| 最近记录: |