When creating a new project Firebase generates browser API keys automatically in the GCP API credentials. This is the same API key that is set in the Firebase Web client SDKs and is publicly available.
By default the key has no restrictions, so it's prone to quota stealing for every API enabled for that project. Surprisingly I have not found information about securing this key in the Firebase documentation.
So I took two extra steps to secure the key:
My question is mostly related to points #2-3. What are the APIs that needs to be enabled for various components of Firebase to work on the web?
In a word, yes. As stated by one of the Firebase team engineers, your Firebase API key only identifies your project with Google's servers. It is not a security risk to expose it.
Using an API key Specifically, they're used to associate API requests with your project for quota and billing. They're also useful for accessing public data. When your app makes a call to a Firebase API, your app will automatically look in the Firebase config file/object for your project's API key.
Make sure you've got the API keys set correctly in your Google Developer Console for your Firebase project. Show activity on this post. There are two different configurations for release mode and test mode. make sure that you use the API key which is related to each.
I also enabled those same two APIs, but I used the Metrics Explorer to see what the various Firebase-created keys had been using based on actual traffic.
In GCP,
consumed_api
and select itcredential_id
, select it, then type service
, and select itsum
By now, the legend for the graph should list all the credential ids and which services they used in the last 6 weeks. You should be able to figure out the APIs from the service.
You can use Filter to filter by credential_id
if the results are too noisy.
By default the key has no restrictions, so it's prone to quota stealing for every API enabled for that project.
This is indeed possible and I am able to make e. g. Google Maps API call with the auto generated Firebase API key.
Such preconfigured behaviour was certainly unexpected and I am now experimenting with the restrictions as per the extra steps described in the original question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With