Firebase的SHA-1问题以及Google-Auth和Phone-Auth [英] SHA-1 problem with Firebase and Google-Auth and Phone-Auth

查看:142
本文介绍了Firebase的SHA-1问题以及Google-Auth和Phone-Auth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在制作一个应用程序,您还可以在其中使用Firebase通过您的Google帐户或手机号码登录.使用keytool,我已经读取了SHA-1,并将其存储在Firebase的项目设置中(我也通过Android-Studio中的Gradle读取了SHA-1值,当然,它与Keytool中的值相同.) .当我在调试时测试应用程序时,一切正常.一旦发布APK(签名的APK V1和V2)并安装了该APK,就无法通过Google或手机号码登录. 错误:

I'm currently making an app where you can also login via your Google account or mobile phone number with Firebase. With the keytool I have already read my SHA-1 and stored it in the project settings of Firebase (I also read the SHA-1 value via Gradle in Android-Studio, of course, it's the same value as in Keytool.). When I test the app while debugging, everything works fine. As soon as I make a release of the APK (signed APK V1 & V2) and install this APK, logging in via Google or mobile phone number is not possible. Error:

该应用无权使用Firebase身份验证.请确认在Firebase控制台中配置了正确的软件包名称和SHA-1. [应用验证失败]

This app is not authorized to use Firebase Authentication. Please verify the correct package name and SHA-1 are configured in the Firebase Console. [App validation failed]

在Firebase控制台中,指定了正确的SHA-1.发行后,APK的SHA-1值是否不同?为什么一切在调试时都能正常工作,而不是在发布之后?

In the Firebase console, the correct SHA-1 is specified. Or does the APK have a different SHA-1 value after the release? And why does everything work while debugging, not after release?

如果有人可以帮助我,那将非常好.

It would be really nice if someone could help me.

推荐答案

如果仍然有人需要,这里有详细的解释...

In case if still anyone needs it here's a detailed explaination...

在调试时,您会创建一个调试sha1密钥,该密钥将使您可以在调试模式下正常工作,但是在创建签名的apk时,您需要为此生成一个sha1来发布版本.

While debugging, you create a debug sha1 key which will let you work proper in debugging mode, but when you create a signed apk, for that you need to generate a sha1 for release builds.

为此,keytool -list -v -keystore (now here you need to provide the relative path for your key.keystore[which you generated while generating signed apk]) -alias (now the alias name is present in gradle.properties and default is my-key-alias)

这也适用于他们,他们的应用在特定设备(而不是其他设备)上创建签名的apk后会获得otp.

Also, this works for them too whose app gets a otp after creating a signed apk on a particular device but not on different device.

希望这会有所帮助.

这篇关于Firebase的SHA-1问题以及Google-Auth和Phone-Auth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆