I'm trying to enable the Google Sign-In provider in Firebase Authentication, but it's failing to be enabled when I click Save as I'm getting a "Error updating Google" message.
I have added my SHA1 fingerprint to my Firebase project and I tried enabling the provider in incognito mode, but it still fails. I also checked the Menu -> More tools -> Developer tools for errors, but I don't see any. How do I fix this?
The solution is to recreate the Firebase and Google Cloud projects.
After deleting everything, first create a Firebase project. Then, the Google Cloud project will be created automatically. There is no need to create a separate Google Cloud project.
After this, don't forget to delete and create new SHA-1 and web_client_id keys:
delete the debug.keystore.
run ./gradlew signingreport from the app's directory to make sure there are no keys remaining.
build the app in Android Studio - it will generate new keys automatically during new build.
run ./gradlew signingreport from the app's directory to make sure that new keys are there.
You may also refer to this documentation.
I am trying to create a firebase project using the api. The document for this is here: https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects/addFirebase
I have created a GCP project already and I am the owner of this project. I can see my project in a request to:
https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/availableProjects/list . It has a project id of: projects/my-project-id-here
I am making the requests as a owner of the GCP project user account (I am not using a service account!) using Google OAuth 2.0 with the correct scopes (You can try it in the documentation), but I am receiving a response of:
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
I can create firebase project fine If I go to firebase website directly and create the project there.
Google take 30 days to delete my test projects, so I am restricted to how many times I can try to get this right from scratch. Therefore I am also interested to know how you fully unlink firebase from a GCP project without deleting that project. Removing the service account and disabling the APIs from GCP console doesn't seem to do the trick.
Finally, I do not know if it is relevant but I also have the same user account setup with a developer account on google play and the GCP project is linked up for API access it's created service account granted access. I don't think this is relevant though, as my understanding is that I can setup a firebase project without this.
Hope someone can help!
I've found the solution to this. You cannot use the firebase API to create a firebase project unless you've first accepted the terms and conditions which aren't shown to you until you're in a firebase project (go figure).
Anyway here are some clear steps:
Create a firebase project through the website
Open the firebase project
Accept the terms and conditions for firebase use
Delete the firebase project and enjoy the API now working.
Regarding your interest in removing firebase from a project, this is not supported. The best course of action is to undo the changes that were made when firebase was added, namely disabling the firebase APIs, removing oauth client/brand, removing API keys etc, which you have already done, and it’s the closest thing to deleting the project.
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.
i am developing a serverless client app that uses Firebase authentication and other services from Google. It was all working nicely, when suddely the FB login authentication stopped working. It happens that when try to login the user i obtain a 400 BADREQUEST with the following body:
{
"error": {
"code": 400,
"message": "API key expired. Please renew the API key.",
"errors": [{
"message": "API key expired. Please renew the API key.",
"domain": "global",
"reason": "badRequest"
}],
"status": "INVALID_ARGUMENT"
}
}
The url causing the problem is:
https://www.googleapis.com/identitytoolkit/v3/relyingparty/getProjectConfig?key=AIzaSyDXJ1Lwo_Md0xZzFfPX9Y8dQWOaODE4uiM&cb=1534851951010
Some weird things:
i tested with totally different projects (so brand new keys): still failing
if i go to cloud console i found several unrestricted keys automatically created by Google (i attach a screenshot)
I also created a brand new app and executed it locally. Same outcome.
Any ideas ?
Add: i have just discovered that the Identity API is effectively returning me 100% failures at the moment.
I was able to get this issue as well and this helped me solve my issue:
Go to google api console and find the key: Android key (auto created by Google Service). These keys are automatically generated by Firebase when you choose the option: Email/password in authentication. Copy that key.
Go to the google-services.json in your android studio under the projects section. Click on the file and look for the api_key -> current_key. Modify that value with the api key in step 1.
I had the same problem, i fixed it by:
Resetting my project, which included...
Deleting the Google-Services.json file, replacing the SHA1 key, syncing and adding the new Google-Services.json file on my project. hope it helps you.
Cheers
I Was able to resolve the issue by going into my firebase project settings> General> update my old API key with the Web API key value.
First, go to https://console.firebase.google.com/
Then choose the Android project
Then go to SETTINGS of that project
First, check that: sha1 and sha256 fingerprint are there for debug apk (Necessary) and release apk (necessary if you create a signed apk)
There you will see a download JSON file button, click on it, and download the file.
Then go to Android Studio and OPEN your project.
Then on the left side menu, click the project subfile then find the googleservices.json file.
Open that file by double-clicking it
Now open the downloaded file, googleservices.json, and open it in notepad.
Now copy all the content, just select all, and copy.
Now go to the Android Studio, and right-click on the Google services file (in IntelliJ) and click compare with the clipboard and carefully accept all the differences into the Android Studio file.
Or you can directly remove all the content and paste the copied into the Android Studio JSON file.
DONE!
NOTE: Make sure you make a copy of the file before doing this.
Open the Firebase Console.
Go to the Project Settings -> General Tab -> Your Web API Key Would have been Updated Automatically. Then Copy that API Key and replace it with API key in your environment.ts File and it will be Working.
Hope it Helps You!
In my case, Android Studio hasn't correctly generated string.xml based on the updated data in google-services.json, so when I replaced the old API key manually, it finally worked.
AngularFire, Ionic, Angular
I got the new API key from Browser key (auto-created by Firebase) in Google cloud console and replace it:
environment.prod.ts
firebaseConfig: {
apiKey: 'here'
}
and also D:\me\my-mobile\android\app\google-services.json
"api_key": [
{
"current_key": "here"
}
Now it is working fine.
Go to your google cloud platform, Goto API credentials and compare your downloaded google services JSON from Firebase with what's in the API credentials of GCP.
It can so happen that youre using a wrong ClientID or API key in your JSON.
Cheers
I was able to clear this issue by the following steps:
This is happening because of the expired Web- API key in firebase. So open your project console.
Move to your project settings
Grab the Web-API key over there
Open your flutter project and move to google-services.json file
replace the current-key value with the new copied API key.
Or simply replace old google-services.json file with newly downloaded one which is present in the same project settings.
Run flutter clean in your project terminal
Run flutter pub-get to get dependencies
Rebuild your app and done.
Hi All if you are getting this error:
error: Error [firebase_auth/internal-error] {"error":{"code":400,"message":"API key not valid. Please pass a valid API key.","errors":[{"message":"API key not valid. Please pass a valid API key.","domain":"global","reason":"badRequest"}],"status":"INVALID_ARGUMENT","details":[{"#type":"type.googleapis.com/google.rpc.ErrorInfo","reason":"API_KEY_INVALID","domain":"googleapis.com","metadata":{"service":"identitytoolkit.googleapis.com"}}]}}
this means you are trying to run app on web chrome and in your flutter app this is not configure so follow below steps:
1. Go to https://console.firebase
2. Select your project name i.e. "E-Commerce App"
3. Select Add App option from dashboard select platform (flutter/android/ios/web) from this select flutter
4. Add Firebase to your Flutter app this screen will open then select next
5. From any directory, run this command:"dart pub global activate flutterfire_cli"
6. Then, at the root of your Flutter project directory, run this command:"flutterfire configure --project=eshop-a44ca"
7. After "flutterfire configure" check npm
add this in main.dart file:
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
8. Run this command in your project directory npm install -g firebase-tools
9.Again run this command ""flutterfire configure --project=eshop-a44ca" you will see below screen [firebase options file created in lib folder]
9. now you can sign up/register user successfully
10. [user created on firestore database ]
[1]: https://i.stack.imgur.com/NBiDz.png
I'm currently building an open-source microservice that makes use of Firebase Database, Hosting & Functions. The plan is to pack everything in a single binary and distribute this. So users will have a hazzle-free, "bring your own Firebase project"-solution. They'll just have to download the binary and their Firebase secret key and can then create a user and deploy the service via CLI.
The problem is, that firebase-tools require a $FIREBASE_TOKEN when deploying via its API. So users would have to install firebase-tools in order to be able to generate that token and they would also have to store it (or re-generate it frequently).
Since I would like to provide a hazzle-free experience, I'd rather generate that token myself with the help of the secret key.
The question is: is this even possible? And if yes: how??
My workaround for this is to reflect the login- and logout-commands of the Firebase-CLI on my own binary's CLI. So the user won't have to install another tool.
To get the refresh_token I then read the data from the firebase-tools-configstore, that is located in the user folder. This feels a little dirty, like accessing a private API. But I couldn't come up with a better solution. And it works.