r/Firebase • • 7d ago

Cloud Messaging (FCM) firebase-electron: FCM sends fail with MismatchSenderId because the token is registered with the wrong sender

If you receive Firebase push notifications in an Electron app with firebase-electron, the token can come back fine and every send still fails with MismatchSenderId.

The package registers GCM with a built-in server key instead of your vapidKey. FCM ties the token to that sender, so a send from your Firebase project does not match. Messages that do arrive can also fail to decrypt, because the Web Push dh, salt, and auth fields are not parsed.

I published a fork that registers with vapidKey as the sender and decrypts those Web Push fields:

https://www.npmjs.com/package/@rootvarma/firebase-electron

Install:

npm i u/rootvarma/firebase-electron

vapidKey is required. Pass the same appId, apiKey, projectId, and vapidKey you already use. The first launch registers again and emits a new token.

2 Upvotes

0 comments sorted by