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.
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.
SafetyNet is newly developed feature for android. But solved the issue without doing any changes in the App.
Following steps helped me to solve.
Release Version
Google Signs the Appbundle when you upload. So, Find and copy the SHA1 key of the app signed by google.
Google Play Console - App Signing Key
Navigate to your project -> Project Settings in Firebase Console and add SHA1 key by clicking on Add fingureprint.
Debug version
Navigate to android directory of your project with following command with Terminal.
cd android
Generate app signingReport and copy the SHA1 key
gradlew signingReport
on Mac :
./gradlew signingReport
Add the SHA1 key in firebase app.
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.
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.
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.
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.
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.
This was worked for me :-
If your app is published on the play store, Copy App signing key certificate from the Google Play console (Release > Setup > App Integrity page). Insert your signing key to your Firebase Console(Project settings Page).
Follow this link - https://developers.google.com/android/guides/client-auth
I removed my phone number from phone number for testing on firebase and it was worked for me when working on real device not emulator.
Related
Please help! Ive been trying so much methods but yet still I get the error:
[auth/app-not-authorized] 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
Im trying to sign in with phone auth on a react native app with firebase.
Im using https://rnfirebase.io/auth/phone-auth
Ive enabled Phone number sign in on firebase. Ive enabled Android Device Check API. Ive created an android project on firebase with the package name being the same name as the package name in my code base. Ive added the fingerprints to firebase, both SHA-1 and SHA-265. These fingerprints are the fingerprints under google play console -> app integrity -> app signing. Ive also added the fingerprints that logs out when I enter this command: ./gradlew signingreport. Ive always updated the google-services.json file when I changed things. Ive cleaned the android folder and rebuilt it but still I keep getting that error. I am using a real device.
Short Summary:
This app works on a physical android phone. However, when we try to make it work on the emulator, Google Sign In does not work. Please see the details below:
Details:
We have created a Flutter app to share information to our internal team.
Pre Google Play Store Update: At the start, we connected Firebase to the app. Added the debug SHA 1 key to Firebase. Google Sign-In works as expected in both the emulator and phone.
Post Google Play Store release:
a. List item
a. We deleted the debug SHA1 from Firebase and changed the SHA1 key to the key which Google
Play store gives us.
b. Downloaded the new google-services.json from Firebase and added it to our androip/app folder. The Google Sign in Works on the Phone but does not work via the Emulator. We get the following error:
I/flutter (24658): PlatformException(network_error,com.google.android.gms.common.api.ApiException: 7: , null, null)
We re-added the Debug SHA1, and Debug SHA256 keys to Firebase.
Still, Google Sign in does not work on the Emulator. But works properly in the Phone.
Checked about 7 previous StackOverflow response, but most responses are for PlatformException(sign_in_failed...) or other reasons, but not for PlatformException(network_error...) .
examples of solutions tried:
Google sign in failed com.google.android.gms.common.api.ApiException: 10:
Generate SHA-1 for Flutter/React-Native/Android-Native app
Internet permissions is enabled in the AndroidManifest.xml
Please let us know if any code is to be shared to analyse the issue better and we will share it.
Thank you in advance.
You are probably now building a release version to install on the emulator in Android Studio, but you don't have the release sha-1 shared with Firebase. Add all three sha-1 to Firebase: Debug and Release sha-1 from Android Studio, and sha-1 from the Play Store. Then download and install the new google-services.json from Firebase and add it to your android/app folder. Then clean and rebuild your app. All versions of your app should then work with Firebase and Google sign in.
Please verify the date and time. Sometimes wrong date & time are set on emulators.
Sometime This kind of error because of network permission not inserted in AndroidManifest.xml file
Put below line in AndroidManifest.xml file
<uses-permission android:name="android.permission.INTERNET" />
Also check working internet connection of mobile data or wifi.
I am able to login to Google with my Flutter Firebase app in debug mode where I have signed the app with the debug key.
Now, my app just got released on Play Store and it is signed in with the release key. But, the app from Play Store - I am not able to sign in with Google. I have SHA1 entered in Firebase but I guess the issue might be the SHA1 is debug SHA1 and it might not be working with the release version of my app. What needs to be done ?
I just figured it out - and if it can be helpful to you or future viewers...you need to add Google's SHA1 and SHA256(optional) keys into your firebase project. And it works just like how I wanted...
Something similar happened with me, I reconfigured Firebase with Flutter and also added my payment details in firebase
I would suggest that you do the same and update the application.
enter image description here
Hello guys, i just created my first app, and when emulated worked perfectly, but when i build the apk release file, i get this toast code 10, message 10:, i know there are the same questions but and i have tried to solve the problem using the solutions in previos posts, but no result, i have changed the SHA1 many times, donloaded json files many times, re installed the app, and erased the google account, none of that worked, the issue is only with google signing option, whe using the email option it works fine, i am using
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-auth:19.2.0'
If you are using app signing by Google Play, you need to make sure that you add the SHA-1 fingerprint from the Google Play Console to your list of Firebase fingerprints.
After you have uploaded your app to the play store, go to your Google Play Console, select your app, and under Release Management, select App signing:
On that screen, you can find the SHA-1 fingerprint in the App signing certificate section. Copy and paste that into your Firestore fingerprintes (Firebase Console -> Project -> General Settings).
Onc you add it, it may take a few minutes to take effect but this fixed the issue for me.
My app has sign in via google and facebook buttons, they are working well when I export release the apk but they aren't working when I publish it on google play store.
I tried putting SHA-1 certificate fingerprint on firebase specifically to add finger button I get the following error message.
An OAuth2 client already exists for this package name and SHA-1 in another project. You can omit the SHA-1 for now and read more about this situation and how to resolve it.
Honestly, I can't find it.
You absolutely need to add the combination of the release apk SHA-1 and app ID to your project in the console. If you can't do that, contact Firebase support directly.