[英]Firebase Phone Authentication
I try to build an messenger in wich the user should be able to login via his phone number. 我尝试构建一个使用户能够通过其电话号码登录的Messenger。 I set up my project in Firebase with the correct SHA-1 code and the correct packagename.
我在Firebase中使用正确的SHA-1代码和正确的程序包名称设置了项目。 But when I try to verify my phone number, I am getting this error:
但是,当我尝试验证电话号码时,出现此错误:
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]
When I start my App from Android Studio, it is working fine. 当我从Android Studio启动我的应用程序时,它运行良好。 But when I upload the App to the Google Play Store, it is not working.
但是,当我将应用程序上传到Google Play商店时,它无法正常工作。 What am I doing wrong?
我究竟做错了什么?
I am starting the verification with this code: 我将使用以下代码开始验证:
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(
Arrays.asList(
new AuthUI.IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build()
))
.build(),
RC_SIGN_IN);
I have this library for authentication: 我有这个用于身份验证的库:
compile 'com.google.firebase:firebase-auth:11.0.1'
and this for the UI: 这对于UI:
compile 'com.firebaseui:firebase-ui:2.0.1'
I think you have two SHA-1 keys, one you use in Android Studio and one that is used when you upload the app to the Store. 我认为您有两个SHA-1密钥,一个在Android Studio中使用,另一个在将应用程序上载到商店时使用。 You can check the SHA-1 key with the keytool command:
您可以使用keytool命令检查SHA-1密钥:
keytool -list -v -keystore keystorename -alias alias -storepass storepass -keypass keypass keytool -list -v -keystore keystorename -alias 别名 -storepass storepass -keypass keypass
Additionally, if you have enabled App Signing, Google will create a new certificate which will be used to sign the APK on the user's device. 此外,如果您启用了应用签名,则Google将创建一个新证书,该证书将用于在用户设备上对APK进行签名。
https://support.google.com/googleplay/android-developer/answer/7384423 https://support.google.com/googleplay/android-developer/answer/7384423
In the Release Management section, check App Signing. 在“发布管理”部分中,选中“应用签名”。 App Signing Certificate is the certificate sent to a user's device and Upload Certificate is the one you uploaded.
“应用签名证书”是发送到用户设备的证书,而“上传证书”是您上传的证书。 Add the SHA-1 in the App Signing Certificate to your Firebase Project.
将“应用签名证书”中的SHA-1添加到Firebase项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.