简体   繁体   中英

Firebase Phone Authentication

I try to build an messenger in wich the user should be able to login via his phone number. I set up my project in Firebase with the correct SHA-1 code and the correct packagename. 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. But when I upload the App to the Google Play Store, it is not working. 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:

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. You can check the SHA-1 key with the keytool command:

keytool -list -v -keystore keystorename -alias 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM