Expo + Firebase 身份验证(身份工具包)API 密钥 android 限制

时间:2021-07-27 07:13:47

标签: android firebase firebase-authentication expo

简而言之:通过 Expo 完成的使用 Firebase 身份验证 (Identity Toolkit) API 密钥的 android 应用程序是否可以被限制为使用 android 应用程序?电子邮件/密码认证

我有一个使用 Firebase 服务的 android 应用程序。我在 Firebase 项目中添加了 android 应用程序,并尝试限制 android 应用程序自动生成的密钥(在 Google 控制台中)但没有成功。

-我已将 https://docs.expo.io/guides/using-firebase/ 用于 Firebase SDK 设置

-下载 google-service.json,将其添加到项目的根目录(与 app.json 处于同一级别)并在 app.json "expo.android.googleServicesFile": "./google-services.json 中定义它”。

-然后在 Google 控制台上为我的 Firebase 项目的 android 应用自动生成 api 密钥:
--我已定义“Android 应用”应用程序限制,
--从app.json添加包名"expo.android.package"
--并从https://expo.dev/accounts/{username}/projects/{project}/credentials
获取SHA-1证书指纹 经典 Android 凭据:构建凭据:SHA-1 证书指纹

我已经能够以同样的方式限制 Maps SDK for Android 和 Geocoding API。

我尚未将该应用程序添加到 Google Play。

如果有这种情况的说明,我还没有通过测试和谷歌搜索找到解决方案。
感谢大家的帮助!

编辑: 我还查看了我的构建日志:阅读清单。
- 我不知道是否需要 oauth_client,但它下的值与 Firebase 项目中给出的值相同,client.oauth_client.client_id 与 Google 凭据中自动生成的 OAuth 2.0 客户端 ID 键相同
-client.api_key 与 Google 凭据页面中的相同

EDIT2
- 现在我在 Firebase 中重新创建了 android 项目,并将它连接到 GCP 上现有的 api 密钥(我用于地图和地理编码的一个有工作限制的)。因此,我更改了我的 android 项目中使用的密钥以对应 api 密钥,现在 我在尝试登录时收到一条新的错误消息

FirebaseError: Firebase: Error (auth/requests-from-this-android-client-application-<empty>-are-blocked.).

我正在 Expo Go 上进行测试,所以现在我将测试这是否适用于构建 APK。

0 个答案:

没有答案
相关问题