2

while creating an FCM project I noticed two different API-keys provided as follows;

1- in the google-servies.json file

"api_key": [
        {
          "current_key": "the key"
        }
      ],

2- and another one called Web API Key in the app settings on firebase console

What is the difference between both of them and the usage?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
aya salama
  • 903
  • 1
  • 10
  • 29
  • 2
    App key/id: is used by the server to track how many API requests are made by a particular app in a day so that server can charge the client if request count exceeds the given threshold. WebAPi key is used for web notifiacation purpose – Vadivel Nov 23 '16 at 09:26
  • 1
    Possible duplicate of [Firebase Cloud Messaging different keys](http://stackoverflow.com/questions/40357782/firebase-cloud-messaging-different-keys) – AL. Nov 23 '16 at 23:45
  • Yes, it's a duplicate – aya salama Nov 24 '16 at 08:24

1 Answers1

0

Web Api key is used to connect your server with google cloud to send message to your apps. For example :

Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

{
  "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
  "data" : {
    ...
  },
}

https://developers.google.com/cloud-messaging/http

Tasneem
  • 793
  • 8
  • 24
  • On the contrary the document states Server key is the key used by your server to send messages. Web API key I have no idea, I suspect it's used by Web clients to register their app for push notifications and is safe to expose to the public – Nicholas May 09 '18 at 06:57