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.
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.
Add SHA1 and SHA-256 in your new firebase account .
Add dependency in build.gradle(:app)
implementation 'androidx.browser:browser:1.3.0'
Go to google cloud console , select your project .
Click on navigation menu and select APis & services and then select Dashboard .
Click on enable api and services and enable api " Android Device Verification".
Download and replace the latest google-services.json file in your project.
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
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.
It’s because of the SHA key.
Add a debug key + Add a release key into your firebase app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With