20
votes

I've been trying to achieve phone auth using Firebase authentication. It's working with an android emulator. I used a test number and a real number in the emulator. Both works. But only the test number is working with a real device and throwing this exception for other numbers

Error is:[firebase_auth/missing-client-identifier] This request is missing a valid app identifier, 
 meaning that neither SafetyNet checks nor reCAPTCHA checks succeeded. 
 Please try again, or check the logcat for more details.

I setup SHA key in firebase also.

7

7 Answers

18
votes

I am guessing you have not enabled the Device Check API. All you need to do is enable the Device Check API on the cloud platform.

I think after some updates they have made this change that for Safety Net you need SH1 Authentication along with enabling Device Check API.

You can follow the Steps as mentioned here.

Once you enable the device check api. Restart your application. It should work like a charm.

Do lemme know if you need further steps.

5
votes

Android has added SafetyNet you can read more here. But what you have to do is

1. enable the Android Device verification api here. and

2. If you haven't yet specified your app's SHA-256 fingerprint, do so from the Settings Page of the Firebase console. For more info read details here.

2
votes

I resolved my issue by removing by old android studio sha-1 and sha-256 keys from firebase and adding a new one from the latest android studio.

1
votes

I have fixed this error. In my case I added two android projects with same SHA-1 in single firebase project. Once I removed one project from firebase project. Now it is working for me.

0
votes

I found this after much searching and should work for you or anyone else who stumbles here:

Put this line inside app/build.gradle under dependencies

implementation "androidx.browser:browser:1.2.0"

It is because its do reCAPTCHA verification and opens up browser.

0
votes

There are two ways Firebase Authentication accomplishes this:

SafetyNet: If a user has a device with Google Play Services installed, and Firebase Authentication can verify the device as legitimate with Android SafetyNet, phone number sign-in can proceed.

or

reCAPTCHA verification: In the event that SafetyNet cannot be used, such as when the user does not have Google Play Services support, or when testing your app on an emulator.

So your solution is either one of two

  • Retest on a real device

  • Add reCAPTCHA verification functionality to your app so you can proceed with your emulator.

0
votes

For safetyNet or reCaptcha issue follow This link.It helped me to solve the problem when i was stuck