8

Flutter App Firebase Phone Authentication Error:

This request is missing a valid app identifier, meaning that neither safetyNet checks nor reCAPTCHA checks succeeded.

Please help me to solve this issue.

enter image description here

Afsanefda
  • 2,141
  • 1
  • 26
  • 50

3 Answers3

8
  1. Open android studio and click on gradle in right corner > click your project > select app > select tasks > select android > click on signing report > copy our SHA1 and SHA-256 from there.

  2. Add SHA1 and SHA-256 in your new firebase account .

  3. Add dependency in build.gradle(:app)

    implementation 'androidx.browser:browser:1.3.0'

  4. Go to google cloud console , select your project .

  5. Click on navigation menu and select APis & services and then select Dashboard .

  6. Click on enable api and services and enable api " Android Device Verification".

  7. Download and replace the latest google-services.json file in your project.

  8. Clean and rebuild project.

Check if you have completed all 7 steps in your proejct . If your app is live on plays store make sure your firebase project have release SHA1 key too . For more info about release and debug keys you can check this

Himanshi Thakur
  • 664
  • 4
  • 15
4

It’s because of the SHA key.

Add a debug key + Add a release key into your firebase app.

1

This is happening because Firebase needs to verify if the phone number sign-in requests are coming from your app. For this, it uses either SafetyNet or reCAPTCHA verification. According to the documentation, in case the user doesn't have Google Play Services support(and in some other cases), a browser screen will open for captcha verification. Only after a successful verification, the OTP will be sent.

So, to enable SafetyNet and reCAPTCHA verification, follow these steps:

  • Go to Google Cloud Platform and ENABLE Android Device Verification.

  • Open your terminal and run

    keytool -list -v \

    -alias androiddebugkey -keystore ~/.android/debug.keystore

(For Windows, replace ~ with your user profile address)

  • Copy the SHA1 and SHA256 certificate fingerprints printed on the Terminal.

  • Go to Settings in your Firebase Console and add both the fingerprints under the 'SHA certificate fingerprints' column.

  • Download the latest google-services.json from Firebase Console Settings and replace the older one in your project.

  • Add the following dependency in app-level build.gradle (because it needs to open browser for captcha verification)

    implementation 'androidx.browser:browser:1.3.0'

NOTE: Keep in mind that the project you're selecting after opening Google Cloud Platform is your concerned Firebase project. If your project doesn't show on the screen that opens, click on SELECT PROJECT, go to ALL tab and then select your project.

screenshot

Ishu Raj
  • 21
  • 2