Firebase auth was working fine, the debug build suddenly started failing without any change of code, logging the folloing message
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 ].
The only notable action inbetween a successful login and failure is android studio upgrade.
Make sure you add the SHA1 key from Play Console to your app in the Firebase Console. Also, the google-services. json file needs to be downloaded again, and added to app, after submitting to app store. Then re-upload to google play store.
In the Firebase console, open the Authentication section. In the Sign in method tab, enable the Phone provider if you haven't already. Open the Phone numbers for testing accordion menu. Provide the phone number you want to test, for example: +1 650-555-3434.
SHA1
and SHA-256
BOTH the certificate fingerprints from the play store console.Play store Console > Your project > Release > Setup > App integrity
SHA1
and SHA-256
fingerprints to your firebase app one by one.Firebase Console > Your project > Settings of the app > Add Fingerprint
Ref: Authenticating Client Using Play App Signing
SHA1
and SHA-256
. Get it by ./gradlew signingReport
. Get more info from here.
SHA-1
and SHA-256
fingerprints to be added in the Firebase project.google-services.json
file.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.
Easiest way would be to connect/sync to firebase from
Tools>Firebase>Authentication>Connect>Sync
If you want to do it manually or for release keystore, first generate SHA-1 checksum using following command:
keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME
Then copy the SHA-1 checksum and go to:
Firebase Console > Your project > Settings of the app > Add Fingerprint
For more info, read this guide: Authenticating Your Client | Google APIs for Android
If you are using a Emulator for 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With