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
Related
I am trying to add the Algolia search extension to a Firebase/Firestore project.
I have followed these steps:
https://firebase.google.com/products/extensions/algolia-firestore-algolia-search
Everything works until I try to deploy the extensions in Firebase through the terminal with the command:
firebase deploy --only extensions
This is the error I get:
i extensions: Verifying secret params for firestore-algolia-search
Extensions deploy had errors:
- create firestore-algolia-search
Request had 1 validation errors: `params.ALGOLIA_API_KEY`: param was required but not provided.
Error: Extensions deployment failed validation. No changes have been made to the Extension instances on
When prompted in the terminal, I first entered the (Algolia) Search-Only API Key. I then realised this probably requires the admin API key, so I changed in to the admin API key in my project here:
\extensions\firestore-algolia-search.secret.local
I still get the error above.
My question: 1. which API key should I use (i think in the terminal it was stated that it would be needed by the emulator) and 2. where do I change it?
Thank you for any help!!
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.
please help me:
I've uploaded my login google firebase project to github, but yesterday i receive this from github to my email:
"GitGuardian has detected the following Google API Key exposed within your GitHub account.
Secret type: Google API Key"
Should i delete ios app & android app from firesabe and create it again? to make a new api key and make "git ignore" and "push" in this new case?
note: the api_key from my .Json is not the same that the api key web from my firesabe setting project
enter image description here
You do not have to delete your project and start again, What you have do is to make sure that you map your api key in .gitignore to avoid it being uploaded to git. If GitGuardian already deleted that is good for you bcz you are safe from ppl getting hold of your keys.
Make sure that you are keep really good track of what is being committed to git and what is not. Specially things like androidmanifest, googleservices etc have to be within your .gitignore.
I register sha-1 release , debug key on firebase
and I All did firebase register tutorial
but I got this message when I call verifyPhoneNumber();
in the verificationFailed: (AuthException exception) {exception.message};
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.
[ A safety_net_token was passed, but no matching SHA-256 was registered in the
Firebase console.
Please make sure that this application's packageName/SHA256 pair is registered in
the Firebase Console ]
I thought i don't need to register sha256 if I register sha1
but it says like that
what is this reason ,
how can i solve this problem??
The solution to this is:
Press 'Win + R' and run "resmon.exe".
Go to CPU tab and search for "build" in Associated Handles search bar.
Right click on "java.exe" process and click on END PROCESS.
Run flutter clean to clean your project dependencies.
Download new google-services.json file from firebase and add it to app folder in flutter project.
Run pub get to get all dependencies again.
Run your project.
Then you're good to go. It worked for me.
This problem's solution is just registering Sha-256 on Firebase console.
GO to android folder and then right click on gradlew and open it in terminal
in terminal paste this gradlew signingReport
Copy SHA-256 and add it in your firebase project.
save and test.
I am working with Master Detail with Firebase Angular template, and I can successfully build the app locally.
But then when I try to reconfigure the app for my own firebase project, nothing seems to change. It continues to query the default app's firebase.
I have followed the instructions for changing firebase app to my own to the letter but I cannot figure out why it still keeps pointing to the old app.
These are the steps I take to change the firebase app:
I create an App in Firebase, using the app id from package.json.
I download google-services.json and copy it to App_Resources/Android/google-services.json
Additionally, I delete google-services.json from platforms/android/app, just in case.
I uninstall the previously installed App from the emulator. I event deleted and created a new emulator to make sure there are no remnants of the previously built app.
I search all the files in the project for any reference for https://car-rental-b26b7.firebaseio.com which is the default firebase app that comes with the template, and I don't find anything at all.
I also edited firebase.common.ts with the following upon successful initialisation:
.then((instance) => console.log("firebase.init done", instance),
Just to see which project its initialising.
7. Finally, I build: tns run android
And sure enough, the console log shows https://car-rental-b26b7.firebaseio.com as the project being initialised.
I know for definite it is copying the new project's google-services.json over to platforms/android/app, because when I deleted the file it refused to build, as expected. Placing the file back, it builds successfully.
But I have no idea why it continues to reference the original firebase project.
Has anyone come across something similar?