Trying to use Google Firebase Authentication with Android Studio - android

We're using Firebases authentication for logging in and registering accounts. For some reason, one person on the team (member 1) is able to use it properly but when myself or another team member (member 3) tries to test it by creating an account or logging in we get the error
com.google.firebase.auth.FirebaseAuthException: The given sign-in
provider is disabled for this Firebase project. Enable it in the
Firebase console, under the sign-in method tab of the Auth section.
We have tried everything we can think of to fix this error. Email/password sign-in is enabled in the firebase project. We've tried completely copying the files on his machine to ours and it still won't work. What's even odder is that it works fine on member 3's laptop, but not his desktop. I've also had member 1 send me a build from his machine onto my phone and it will work then. I tried completely reinstalling Android Studio as well. I'm not even sure what files to show because I can't imagine it's a problem with the code, since it works perfectly fine for member 1 and member 3 on his laptop. If there's any file you need to see I'll be glad to add it.

That might actually be working in the third members laptop because he would have linked the firebase with your project and put the SHA-1 of his laptop, If you want that to work with yours as well then you need to go to firebase console and add SHA-1 to the console to have it work. try this.
And if it helps please do accept i, if I didnt help let me know and il check more for you.

Related

Firebase unable to process request due to missing initial state

I am trying to use phone auth from firebase and I get this error now.
Unable to process request due to missing initial state. This may happen if browser session storage is inaccessible or accidentally cleared.
This was working a week ago and no longer works.
I have solved this by registering my app with SafetyNet with SHA2. To do this follow these steps:
Get your SHA2. If you don't know how to get this, follow this tutorial:
https://www.youtube.com/watch?v=kLaNnuoqnmA
Note. This youtube link is for SHA1 but you will notice that SHA2 will be shown here if you pay attention.
Go to your Firebase Console then, go to Project Settings > App Check. You will notice your app is "Unregistered." click this to register your app.
Enter the SHA2 you copied and Accept some terms below then click Save. you will notice the "Registered" with green check icon.
Btw, this error happens on one of my devices but not on another. I also searched through this error and no one has solved this including this page. This happens in my phone authentication using firebase when getting an OTP as I send my phone number. The app tries to redirect you to a browser for Recaptcha for verification if you don't have SafetyNet. Thus, having no SafetyNet will cause your app to always be redirected for Recaptcha which sometimes causes an error. Thus, to solve this, register your app with Safety Net. to understand this, read this documentation.
https://firebase.google.com/docs/auth/android/phone-auth?authuser=0
Focus on 2. Enable App Verification and you will notice that recaptcha is just an alternative for SafetyNet.
It had on the Ionic/Angular/Capacitor app too. i.e. Android and Chrome. Firebase Auth with Microsoft Login.
So I have cleared all the chrome browser data on the Android device and then no issues. i.e. working fine now.
More workarounds: https://github.com/firebase/firebase-js-sdk/issues/4256
I experienced the issue with an iphone web app. I went into Settings -> Safari and disabled 'Prevent Cross-Site Tracking'.

No reporting in Crashlystics after changing FIrebase project

I have two projects.
connected like this document.
connected with Frabric plugin on Android Studio.
First of all, My colleague connected the first way. It worked fine. After that I needed to create a new project for test. And I connected Crashlystics with Fabric plugin(I didn't know how my colleague connected at that time.)
Now, I needed to connect Crashlystics to the original version(which is 1).
However, It shows the crash graphs, But I don't get any reporting like which line got which error. I checked my test project and it gets the reporting.
So, I disconnected my account connected to Fabric and my app. And then, I get 0 reporting in both project.
At the moment, My setting is just like the document. And of course, I have google-services.json file correctly.
How can I solve this problem?
The two methods that you've followed would have crash reporting at different places.
1st one would report everything on Firebase Console.
2nd would report everything on Fabric dashboard.
To connect fabric to firebase you would just need to migrate your app over to firebase with just a few button clicks and no code change.
My assumption is that you might not have stripped out the Fabric API Key (In your AndroidManifest.xml file) from your code hence the reports are not coming in at firebase console.

Google Login with Firebase Auth returning an error

I opted to go with Firebase Auth for my app and it's generally pretty straightforward. I changed Google accounts early in the development because I wanted to keep these two separate, and I suspect that's what's causing my errors here.
When I click the Google login button, it pulls up the account chooser and then returns nothing. Here's the error in the logs:
GoogleProvider: Error logging in with Google. 10 null
From the Firebase issue tracker, it seems to be associated with a change in your SHA1 fingerprint. Here's the rub: my initial Firebase account has no SHA1 fingerprints associated with it.
Things I've done:
Verified that I have the right SHA token in there, I even brought in the debug ones and I can't seem to get it logged in.
Copied the google-services.json from the correct account.
Tested Twitter, Facebook, and Email and they work flawlessly.
Anyone have any experience here?
Solved it. I was able to find the answer in this Firebase issue tracker thread.
this issue is occuring on debugs builds, right? Every android studio
installation creates a different debug key so you'll have to
regenerate it.
I have two machines that I work on. One is my desktop that I've been pulling keys from (because that's where my release key resides), and another is my laptop where I can code off the cuff. If I want to use the debug build to test this, I need to use the debug SHA1 from the actual machine that I'm running.

Ionic & Firebase Google Login with Googleplus plugin error: 10

So I'm trying to figure out the Google login system using Ionic, Googleplus plugin & Firebase. I set everything up according to the following tutorial:
https://github.com/EddyVerbruggen/cordova-plugin-googleplus
Then I ran the code on my phone as Ionic-run Android. When I do that I get an error 10. I looked it up and according to the following link:
https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/243
It seems like it's an issue with the debug version and the key? In Firebase, I set up an Android project with the debug key but I didn't add the Google.services.json or add the code they told me to add in my build.gradle file because I get an error. I also activated the google sign in method. Then I copied the demo app index. I'm not sure If I missed a step or didn't set something up correctly.
In case it's helpful for anyone else, I spent a lot of time troubleshooting this issue on Android. You need to make sure that your client_id for a credential of type "Web application" is used even though the SHA1 certificate hash you generate is associated with an OAuth2 credential of type Android. I was using the Android client_id instead of the Web application one. More info here: https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/425
I fixed it by using a different project, not really sure what changed.

Google EndPoint not getting called when request has google plus profile url as parameter

My app uses Google App Engine as backend and it provides google plus & facebook login option to user.
One of the endpoint Api takes user profile picture url as input parameter and tries to store it in the user profile table. My endpoint Api was not getting called successfully when user choose the option of google plus as login,
I have narrowed down the issue to find out that it only happens during google plus login scenario and from the backend logs I see the issue is only because of below parameter which is profile photo url.
https:%2F%2Flh3.googleusercontent.com%2F-xPc6TIzQiFA%2FAAAAAAAAAAI%2FAAAAAAAAAeU%2FUIIpz-4G1dQ%2Fphoto.jpg%3Fsz=400
Backend Request from logs(Data changed for privacy reasons).
/_ah/api/registrationAPI/v2/XXXXXX/Rahul%20Purswani/rahulfhp#gmail.com/https:%2F%2Flh3.googleusercontent.com%2F-xPc6TIzQiFA%2FAAAAAAAAAAI%2FAAAAAAAAAeU%2FUIIpz-4G1dQ%2Fphoto.jpg%3Fsz=400/XXX/YYY/VVV, returning NOBODY to imply authentication is in progress.
My Api Class Declaration :
#Api(name="registrationAPI",
version="v2",
namespace=#ApiNamespace(ownerDomain="backend.XXX.XXX.YY",ownerName="backend.XXX.XXX.YY",packagePath=""))
public class PlayerRegistrationEndPoint {
}
And to my surprise this only happens when I test the Api on local development server through real device. If I deploy my api all works fine, I have spent almost the day to narrow it down, If you have any clue about it that will be really appreciable.
Are you accidentally logging the bytes of your pictures using logging.info(), logging.error(), print, etc? Logging bytes to either the logger or standard out can make the dev instances (or even production instance) go into zombie mode.
This has happened to me many times. Check all logs to make sure you aren't trying to log something that isn't a basic variable type.
I was getting this issue since we migrated our code base from Eclipse to Android Studio, during this migration our app-engine sdk version got changed from 1.9.22 to 1.9.18.
Looking back and doing comparative analysis with why it used to work with eclipse, I tried using 1.9.22 app-engine sdk here and issue got resolved, the zombie behavior is no more and even in development environment everything is stable now.
I also checked & removed all the loggers and out statements, though the issue was not fixed with trying that alone.
Thanks for even letting me know that it can also go wrong in future during development environment testing.

Categories

Resources