How to get gcm_sender_id for website in Firebase
Seems like Firebase Messaging actually works even if you skip this step. Look at https://web-push-demo-11213.firebaseapp.com as an example.
This demo website doesn't even have a manifest but is able to talk to FCM, get tokens, refresh them and so on.. Sorry you won't be able to actually send a push though since you don't know the auth key, but you get the idea - I've tested it, it works.
In light of this, not sure why this manifest requirement though.
Also, looking at the FCM SDK source on github, looks like they only throw an error if you have a manifest with a gcm_sender_id
that's not 103953800507
. For everything else (the gcm_sender_id
field in manifest missing, or even the manifest itself missing from the website), it works as fine.
See the code here: https://github.com/firebase/firebase-js-sdk/blob/master/packages/messaging/src/controllers/window-controller.ts#L329-L355
Goto https://console.firebase.google.com -> select your project.
Settings -> Cloud Messaging -> Project credentials -> Sender ID
Hope this help!
The sender ID that you enter in the manifest.json of your web app is independent of your Firebase project. It is the same for all web apps (yours, mine, everybody's):
"gcm_sender_id": "103953800507"
So just copy/paste the line above into the manifest.json for your project. See this section of the FCM documentation.