问题
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.
回答1:
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
回答2:
Simple solution for App-signed enabled app.
- Find SHA-1 certificate fingerprint from App signing from play store console.
Play store Console > Your project > Release management > App signing
- Place both SHA1 fingerprint to your firebase app.
Firebase Console > Your project > Settings of the app > Add Fingerprint
- The good thing is we don't need to generate SHA1 fingerprint from
cmd with the help of
keystore.
回答3:
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.
回答4:
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
generated SHA-1 key by this command
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
来源:https://stackoverflow.com/questions/46751766/this-app-is-not-authorized-to-use-firebase-authentication-please-verify-that-the