Flutterfire: [firebase_auth] SHA-1 fingerprint issue

Created on 13 Oct 2019  路  13Comments  路  Source: FirebaseExtended/flutterfire

I get SHA-1 from debug.keystore using this code

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

I've succesfully created Firebase project and used the SHA-1 fingerprint from debug.keystore. Then downloaded google-services.json and put it into the project. Everything (email auth, anonymous auth etc.) works fine but when I try to verify phone number it gives error.

final FirebaseAuth _auth = FirebaseAuth.instance;

Future<void> _testPhone() async {
    _auth.verifyPhoneNumber(
        phoneNumber: "xxxxx", //I use my personal phone number here
        timeout: Duration(seconds: 5),
        verificationCompleted: (d) {
          print(d);
        },
        verificationFailed: (d) {
          print(d.code + ": " + d.message);
        },
        codeSent: (d, [d2]) {
          print(d);
        },
        codeAutoRetrievalTimeout: (d) {
          print(d);
        });
}

This is the simple code which gives this error:

firebaseAuth: This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed. Is app running on a physical device? ]

I'm testing this on the real device. Version of firebase_auth plugin is 0.8.0. I've tried with the version 0.7.0 (last version that is pre AndroidX) and still gives the same error. Since my package name is correct and I'm using a real device, I guess it's a SHA-1 fingerprint issue.

[鈭歖 Flutter (Channel beta, v1.1.8, on Microsoft Windows [Version 10.0.17134.523], locale en-US)
[鈭歖 Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[鈭歖 IntelliJ IDEA Ultimate Edition (version 2018.2)
[鈭歖 VS Code, 64-bit edition (version 1.27.2)
[鈭歖 Connected device (1 available)

! Doctor found issues in 1 category.
crowd auth bug

All 13 comments

@easeccy

The issue at https://github.com/flutter/flutter/issues/27684 has been closed and moved here. Future collaboration on this issue will be done here.

I added Keys SHA1 and SHA256 for Release and Debug mode into my firebase settings. It worked for me, previously I just was using Keys in Relase mode, adding Debug keys solved my problem.

Debug keys

keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

at the end I have 4 keys, two for release, two for debug.

Hi @easeccy
Did the proposed solution worked?
(thank you @stanlee321)
If are you still experiencing this issue
with the latest version of Flutter and FlutterFire plugin
can you please provide your flutter doctor -v
and your and your flutter run --verbose/flutter build --verbose ?
Also, to better address the issue, would be helpful
if you could post a self contained app on github
or the steps to reproduce it.
Thank you

Still not working.

firebaseAuth: 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. Is app running on a physical device? ]

[ App validation failed. Is app running on a physical device? ]
From my small experience, this seems to indicate that you are in an emulator. In that cas, real phone numbers will not work.

I have lost a lot of time on this issue due to not adding both Keys SHA1 and SHA256.

It is important to add both of them.

Tested on real device with both keys. Still getting the error.

  • Is it possible that your device uses a custom OS ?
  • Are you connection Android studio to your device ? or installing via the Play Store ?

It may be a device related error. This issue can be closed now.

@easeccy, so what does that mean? I have a Mi 9T mobile phone and I'm in the same boat as you were.

I have same issue.
We are not use SHA, but it show error, too.

UPDATE:
It seems I was mistaken, SHA for login phone number is required.

Debug signing certificate SHA-1: A SHA-1 hash is required by Firebase Authentication (when using Google Sign In or phone number sign in) and Firebase Dynamic Links.

The device I was testing on was rooted.

Hi @remoteportal,
If are you still experiencing this issue
with the latest version of Flutter and FlutterFire plugin
can you please provide your flutter doctor -v
and your and your flutter run --verbose/flutter build --verbose ?

Otherwise, this looks like it's been resolved.

Thank you

Was this page helpful?
0 / 5 - 0 ratings