Flutter Firebase Google sign in with release version - firebase

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.

Related

Log errors from app on Google Play using Crashlytics

Probably silly question, but is it possible to send errors using Crashlytics from users that downloaded my app from Google Play? Until now I was using Crashlytics to collect errors from my app distributed by Firebase (so it was only for me and invited people). But I have released my app on Google Play and I can't see any errors from devices that downloaded my app in Google Play. I read that when I link my Google app with Firebase I can see purchase and subscription and analytics but no mention of Crashlytics. So my question is.. Is it even possible? Thank you very much.
Is the package name the same on your "release" version on the store? If your test one was called com.patrik.coolapp.debug (which is the default if you're using a debug build) then you'll need to add com.patrik.coolapp as an App in your Project in the Firebase console.
If you already had Crashlytics set up (all the dependencies, added the plugin, FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true) somewhere in your app) then it should just work - here's some advice on testing:
https://firebase.google.com/docs/crashlytics/test-implementation?platform=android
So I finally made it..
I'd like to thanks to #cactustictacs for help.
The problem was that I did not integrate Google Play in project settings in Firebase, although it is saying that it is just for Analytics and Subscription.
Before I integrated Google Play in Firebase I tried to add FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true) .. it did not work, but I believe it could be usefull to someone.
It wouldn't be such a problem, but it is required to have Owner or Admin permissions on both Firebase account and Google Play console account (which I did not have). After I get the permissions, integration was enabled and I could see test crashes in Crashlytics.

Flutter: (24658): PlatformException(network_error, com.google.android.gms.common.api.ApiException: 7: , null, null)

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.

Firebase phone authentication is not working on Android real device

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.

Why google and facebook login not working after publishing on google play store

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.

Cannot resolve error "default_web_client_id" in firebase auth with google and facebook

I have a project that uses firebase auth with google and facebook, and it worked fine until some weeks, in which the ide sent me this error
Cannot resolve symbol default_web_client_id
I don't know how to solve it because in my firebase console, the sha-1 key that I generated and added when I created the project has disappeared and does not allow me to add the key again showing me this message
Mensaje de error
I followed the instructions on the help site and check my list of credentials in the google api console
Lista de credenciales
and i don't know what's the issue with firebase to add my sha-1 key
Please help
You need to download the google-services.json from your Firebase project. If you haven't added already your Android app to the project you can do so as described here https://firebase.google.com/docs/android/setup.
If you've already done that, just go ahead and re-download the google-services.json, it could have been changed. This helped me.
Make sure that the SHA fingerprint is filled in the Firebase Project's Android app section.

Resources