appfeel / node-pushnotifications

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
544 stars 125 forks source link

Getting `Mismatchsenderid` error with firebase token #158

Open MRashad26 opened 3 years ago

MRashad26 commented 3 years ago
        const settings = {
            gcm: {
                id: globals.push_key,
            },
            apn: {
                token: {
                    key: globals.p8_name
                    keyId: globals.keyId,
                    teamId: globals.teamId,
                },
            },
            production: true
        };
alex-friedl commented 3 years ago

@MRashad26 Looks like a configuration issue on your end? Do you maybe use a legacy GCM sender ID for a FCM application?

MRashad26 commented 3 years ago

@alex-friedl so you mean i can’t use firebase token with this setting?? And if i can, could you please send the right configuration settings to do so?? Highly appreciate your support.

alex-friedl commented 3 years ago

@MRashad26 You should be able to use Firebase tokens without any issue. From what I understand looking at the FCM docs, the sender ID you specified is not allowed as a sender by the respective client app? I think you ned to make sure to use the correct sender ID. Please refer to the FCM docs:

Mismatched Sender | 200 + error:MismatchSenderId | 
A registration token is tied to a certain group of senders. 
When a client app registers for FCM, it must specify which senders are allowed to send messages. 
You should use one of those sender IDs when sending messages to the client app. 
If you switch to a different sender, the existing registration tokens won't work.
MRashad26 commented 3 years ago

@alex-friedl if I'm going to use the firebase APN's Authentication Key for IOS then the APN will look like this apn: { token: { key: '', keyId: '', teamId: '' } } but what will the apn look like if I will use the APN's Certificates instead.

alex-friedl commented 3 years ago

@MRashad26 The format is the same for APN keys obtained from Apple or Firebase. In either case you will have a key file, id and team id

alex-friedl commented 3 years ago

@MRashad26 Do you still experience these issues or have you figured the setup out? :)