GoogleChromeLabs / web-push-codelab

Other
557 stars 293 forks source link

FCM Integration #66

Closed tvoitik closed 6 years ago

tvoitik commented 6 years ago

My goal is to utilize the HTTP API https://developers.google.com/cloud-messaging/http to be able to send a web push notification to 1000 subscribers in one API call.

However, I need to use FCM's new server keys due to them phasing out legacy keys https://stackoverflow.com/questions/37789264/api-key-for-gcm-is-suddenly-invalid-unauthorized-401-error

If I create a new firebase project it can give me the correct Server key to use but it does not give me any public key to use in the service worker and main.js

If I want to use FCM and send notifications with the HTTP API which key do I put in sw.js and main.js?

gauntface commented 6 years ago

I'd use the FCM SDK for what you are trying to do: https://firebase.google.com/docs/cloud-messaging/js/client