API key not valid firebase auth - android

I've had used a firebase account for my android project, and recently I faced some issues with the account so I decided to create a new one and link my project to this newly made project.
Everything seemed to work fine, but when I tried to use firebase auth, I faced an error which says: API key not valid. Please pass a valid API key.
I searched for hours and all I could find was that I had to redownload google-services.json file and replace it. I did it and I still get the same error
Anyone knows what I have to do? Thanks in advance.

I also faced the same issue and in my scenario API key in json file was expired, just follow the following simple steps
1 - Open firebase console and go to project settings.
2 - In project setting under general tab ou can see Web Api Key. Copy that key.
3- Open Android Studio and open google-service-json which is present in app directory.
4- In json file you can see the API key just changed that key with the one you copied from firebase console and boom you are good to go .

After trying all thing that I found on the web about this problem, the thing that worked for me is Clean Build then Invalidate cash and restart

Related

Trying to use Google Firebase Authentication with Android Studio

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.

Question on Firebase Authentication SHA1 for Android [duplicate]

My local android app is synced up in google firebase console with my SHA key configured in google.services.json. How do the developer on other end
can setup the project to use the same firebase console and json file.
We are trying phone based authentication. While setup at my end works is fine, but the developer on the other end is getting this error - This operation is not allowed. You must enable this service in the console.
Please help me with the correct way to do this.
Solution:
So for other developers, generate the SHA-1 Key as described in the picture
Go to Firebase Console:
Settings
Your Apps
Add Fingerprint and paste the SHA.
A solution for the comment:
So the answer is well written in the error. You can't have two projects of the same package name. Even if you delete it. It will take a least 4-5 days to get deleted fully from the developer's console.
So the only solution is to generate a new SHA-1 key by custom signing the app by generating a signed apk from the android studio. Or just create a new project with different package name both ways will work for now.
Hope this info helps. Do let me know if it changes anything for you.
Adding to Sharan's answer, that is the correct one, you can add those SHA1 keys in your Firebase console going to
Project configuration - ADD FINGERPRINT
Remember to select the correct project at the Android apps panel in order to add those keys

How multiple developers can work on the same android app connected to a single Firebase console?

My local android app is synced up in google firebase console with my SHA key configured in google.services.json. How do the developer on other end
can setup the project to use the same firebase console and json file.
We are trying phone based authentication. While setup at my end works is fine, but the developer on the other end is getting this error - This operation is not allowed. You must enable this service in the console.
Please help me with the correct way to do this.
Solution:
So for other developers, generate the SHA-1 Key as described in the picture
Go to Firebase Console:
Settings
Your Apps
Add Fingerprint and paste the SHA.
A solution for the comment:
So the answer is well written in the error. You can't have two projects of the same package name. Even if you delete it. It will take a least 4-5 days to get deleted fully from the developer's console.
So the only solution is to generate a new SHA-1 key by custom signing the app by generating a signed apk from the android studio. Or just create a new project with different package name both ways will work for now.
Hope this info helps. Do let me know if it changes anything for you.
Adding to Sharan's answer, that is the correct one, you can add those SHA1 keys in your Firebase console going to
Project configuration - ADD FINGERPRINT
Remember to select the correct project at the Android apps panel in order to add those keys

The issue in Google Sign-In for Android

brother, I'm now integrating Google login functionality into my app in accordance with Google Docs.
When I follow the instructions in the document, I click on the button Configure a project to Configure a Google API Console project and I filled out all the information that I needed to fill out, including the platform, package name, and the value of sha-1, but when I clicked on the create button in popWindow again, I got the message Something went wrong. Please try again. I have tried numerous times. All of these are the results. Can someone help me to see what causes me? Thanks a lot!!
Please check if you have already added your project in firebase. If you have, do not add the project again in google developer console; it's kind of added to developer console by default. This is how I solved the issue in my case.
Sometime, I fake this problem too
My case is:
1) I create project new from Google console first
2) I start Configure a project for Google Sign for the project created in step 1
3) Enter correct SHA1 and package_name
4) Error "Something when wrong and please try again"
I tested 5 times for 5 new projects and this problem always happened
THEN I SOLVED it by a trick like
1) I don't create new project in Google console
2) When Configure a project for Google Sign, I create new project here (don't use project name which already used before even you have shutdown it)
3) Enter correct SHA1 and package_name
4) It will working with no error
Tested it 3 times for 2 different emails and it working.
Hope it help
None of the following solutions worked for me. What I did was look into my Google API Console > Credentials. Then I noticed that while from the documentation I picked my "Type" to be "android", on the console it appeared as "Web".
When I deleted the credential and re-entered the details it worked like a charm. So if none of the solutions work, try deleting all credentials in the API console and try another time.

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.

Categories

Resources