Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 311
Sadman Hossain Ridoy Avatar asked Dec 29 '20 10:12

Sadman Hossain Ridoy


3 Answers

  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

like image 146
Himanshi Thakur Avatar answered Oct 17 '22 18:10

Himanshi Thakur


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)

  • When asked for password, enter 'android' (without quotes).

  • 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. Ensure that there are no terminal spaces (else will give invalid string error).

  • 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

like image 38
Ishu Raj Avatar answered Oct 17 '22 16:10

Ishu Raj


It’s because of the SHA key.

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

like image 4
user2294087 Avatar answered Oct 17 '22 17:10

user2294087