1

I want to enable Firebase Cloud Messaging for push notifications for my Android app. In the google-services.json file needed for push notifications there's a field called "api_key".

Right now I have "api_key": [{ "current_key": "" }]

Should I put the Web API Key I see on my Firebase Console?

credo56
  • 423
  • 1
  • 8
  • 19

2 Answers2

2

The api_key value in google-services.json is not used by FCM.
(it is used by other Firebase libraries)

Generally speaking do not touch the google-services.json that is provided by the Firebase Console. Just download it and add it to your app as is.

Diego Giorgini
  • 12,489
  • 1
  • 47
  • 50
  • 1
    Thanks for pointing that out. I was aware that the Server Key should always be kept secret. I got it mixed up thinking it should be added. One thing that's bothering me is what is the API key automatically included in the file? Shouldn't all API keys in general, be kept secret? – AL. Oct 31 '16 at 05:47
  • 2
    unfortunately the term api-key is very misleading and different teams use them for different reasons. To try to make things more clear the FCM team calls its key "Server Key" to make it clear that it should be kept secret on the server. Other teams use "api-key" as an identifier of the "project-id". – Diego Giorgini Oct 31 '16 at 06:27
  • I see. That makes sense. Thanks a lot. :) – AL. Oct 31 '16 at 06:52
  • @DiegoGiorgini Thanks for your insight that was helpful. Do you think there is a way to mask this API key anyway? – stepheaw Aug 04 '17 at 14:23
0

Get a new google-services.json file from the Firebase Console. There you can find the right api_key for your app.