Java 此应用无权使用 Firebase 身份验证。请验证 Firebase 控制台中是否配置了正确的包名称和 SHA-1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46751766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
This app is not authorized to use Firebase Authentication.Please verify that the correct package name and SHA-1 are configured in the Firebase Console
提问by ishandutta2007
Firebase auth was working fine, the debug build suddenly started failing without any change of code, logging the folloing message
Firebase 身份验证工作正常,调试构建突然开始失败,没有任何代码更改,记录以下消息
D/PhoneAuthActivity( 7392): signInWithCredential:failure:com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verifythat the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ].
D/PhoneAuthActivity(7392): signInWithCredential:failure:com.google.firebase.auth.FirebaseAuthException: 此应用无权使用 Firebase 身份验证。请确认在 Firebase 控制台中配置了正确的包名称和 SHA-1。[应用验证失败]。
The only notable action inbetween a successful login and failure is android studio upgrade.
成功登录和失败之间唯一值得注意的操作是 android studio 升级。
采纳答案by Nabin Bhandari
When you updated Android Studio, the debug key which is used to sign debug apps might have changed. Just add the new SHA-1 checksum of your debug key in the firebase console.
当您更新 Android Studio 时,用于签署调试应用程序的调试密钥可能已更改。只需在 firebase 控制台中添加调试密钥的新 SHA-1 校验和。
Easiest way would be to connect/sync to firebase from
最简单的方法是从以下位置连接/同步到 Firebase
Tools>Firebase>Authentication>Connect>Sync
工具>Firebase>身份验证>连接>同步
If you want to do it manually or for release keystore, first generate SHA-1 checksum using following command:
如果要手动执行或用于发布密钥库,请首先使用以下命令生成 SHA-1 校验和:
keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME
Then copy the SHA-1 checksum and go to:
然后复制 SHA-1 校验和并转到:
Firebase Console > Your project > Settings of the app > Add Fingerprint
Firebase 控制台 > 您的项目 > 应用设置 > 添加指纹
回答by Chris
Ok i just figured out the issue.. If you are using Play Store app signing, then the SHA1 from you distributed app will be different from the one you are using locally. Make sure you add the SHA1 key from Play Console to your app in the Firebase Console.
好的,我刚刚发现了这个问题。如果您使用的是 Play 商店应用签名,那么您分发的应用中的 SHA1 将与您在本地使用的不同。确保将 Play 管理中心中的 SHA1 密钥添加到 Firebase 控制台中的应用中。
回答by Rumit Patel
Simple solution for App-signed enabled app.
应用程序签名的启用应用程序的简单解决方案。
- Find SHA-1 certificate fingerprintfrom App signing from play store console.
- 从 Play 商店控制台的 App 签名中查找SHA-1 证书指纹。
Play store Console > Your project > Release management > App signing
Play 商店控制台 > 您的项目 > 发布管理 > 应用签名
- Place both SHA1 fingerprint to your firebase app.
- 将两个 SHA1 指纹放入您的 Firebase 应用程序。
Firebase Console > Your project > Settings of the app > Add Fingerprint
Firebase 控制台 > 您的项目 > 应用设置 > 添加指纹
- The good thing is we don't need to generate SHA1 fingerprint from
cmdwith the help of
keystore.
- 好消息是我们不需要在cmd的帮助下生成 SHA1 指纹
keystore.
回答by Udara
I have got the same issue and solve as follow
我有同样的问题并解决如下
Generate .keystore file like in this document https://facebook.github.io/react-native/docs/signed-apk-android
生成 .keystore 文件,如本文档 https://facebook.github.io/react-native/docs/signed-apk-android
generated SHA-1 key by this command
通过此命令生成的 SHA-1 密钥
keytool -list -v –keystore [PATH]\android\app\my-upload-key.keystore
And copy the SHA1 key under certificate fingerprints and add it firebase app settings->genaral tab->your app section->SHA certificate fingerprints
并复制证书指纹下的 SHA1 密钥并将其添加到 firebase 应用设置-> 通用选项卡-> 您的应用部分-> SHA 证书指纹
回答by rakshit ks
If you are using a Emulatorfor phone OTP verification it won't work since it does not have a sim. So try installing it to your mobile(with sim) and check if the error persists.
如果您使用模拟器进行电话 OTP 验证,它将无法工作,因为它没有 SIM 卡。因此,尝试将其安装到您的手机(使用 sim)并检查错误是否仍然存在。
回答by Roach
If you are using Google Internal App Sharing, please note that Google automatically signs your builds with a totally different certificate as stated here, you'll need to find the signing certificate information that is automatically provided for your application build by Google.
如果您使用的是 Google 内部应用共享,请注意,Google 会使用此处所述的完全不同的证书自动对您的构建进行签名,您需要找到 Google 自动为您的应用程序构建提供的签名证书信息。
To find the certificate;
找到证书;
- Sign in to your Play Console.
- Select your app.
- On the left menu, select Development tools > Internal app sharing.
- Select the “App certificate” tab, and then copy the SHA-1 to your firebase console.
- 登录您的 Play 管理中心。
- 选择您的应用。
- 在左侧菜单中,选择开发工具 > 内部应用共享。
- 选择“应用证书”选项卡,然后将 SHA-1 复制到您的 Firebase 控制台。