I am using Firebase PhoneAuth and getting the following error.
Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.
W/Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [400 Bad Request: {
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console",
"url": "https://console.developers.google.com"
}
]
}
]
}
}
]
The error says that the API key you use when initializing Firebase is not accepted by Google. You might in fact be using an invalid API key or Google might incorrectly identify your API key as invalid. The latter can happen if your API key has not been used in a long time.
FirebaseInstallations
is new infrastructure for Firebase services that makes use of the API key you use when initializing Firebase. If you recently updated your Firebase SDKs, FirebaseInstallations
might have started using your API key which was not used before.
If you have issues with your current API key, you can create a new API key in the Cloud Console:
APIs & Services
→ Credentials
+ CREATE CREDENTIALS
→ API key
In case you are using the google-services.json
config file from your Firebase Console, you first have to delete or restrict the API key used in your current google-services.json
in order to make Firebase update config file and use a new API key.
google-services.json
config file.Usage with this service
of your API key should show a number greater than 0.Application restrictions
to that API key by clicking the pencil symbol. !!Warning!! Do not delete an API key that existing installations of your applications require for other Firebase services like Firebase Auth or Realtime-Database.Wait a couple of minutes for Google servers to update. The next download of your google-service.json
config file should contain a new API key.
Other relevant links regarding API keys and the Firebase Installations API: