FCM Push Notification: MismatchSenderId

21,305

Solution 1

According to the docs

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.

So it sounds like you are trying to send a push notification to an ID that is not associated with the sender ID. You should verify that you have the correct keys in the correct places

Solution 2

Sounds like Google Services on your Android app has been configured incorrectly.

Log into Firebase console, open your project (click the gear icon). Under General tab, scroll down to "Download the latest config file" and click on the button to download google-services.json (which should include the correct project and sender ID)

Send this to your mobile devs to include in the app and once the app's sent a valid push token, try sending again.

Share:
21,305
Jeric John Romero
Author by

Jeric John Romero

Updated on October 16, 2021

Comments

  • Jeric John Romero
    Jeric John Romero over 2 years

    Good day,

    I am trying to use this URL from FCM to send messages:

    https://fcm.googleapis.com/fcm/send

    With a header of

        Authorization value of **key:*Key from Firebase Console***
        Content-Type: **application/json**
    

    The body consist of this:

        {
           "to" : "MyKey generated",
           "notification" : {
           "body" : "Hey",
           "title" : "Hey"
        }  
     }
    

    But the result i always received is this:

         {
            "multicast_id": 7942550122547405787,
            "success": 0,
            "failure": 1,
            "canonical_ids": 0,
            "results": [
                {
                   "error": "MismatchSenderId"
               }
          ]
        }
    

    The server key I got is from here:

    Server Key

    My URL reference is the docs in FCM server.

    I am testing this in Postman. Did I miss something? Thanks

  • Jeric John Romero
    Jeric John Romero over 6 years
    Does that mean that the token I am receiving from mobile app does not associated to the sender ID? I am working with the backend side, unfortunately, I have to confirm this with the mobile dev, right ?
  • tyczj
    tyczj over 6 years
    That means you are using the wrong server key with with the sender id for your app or you are using an old id that was created with a different sender id. Since the sender id is needed in the app to create the instance id you have keys messed up somewhere. I would verify your keys in the project settings in firebase console
  • Jeric John Romero
    Jeric John Romero over 6 years
    I don't understand the header. I just don't put the Authorization value in my post.
  • Jeric John Romero
    Jeric John Romero over 6 years
    Another test: the token I used in postman is the same token I use in the notification link in firecloud. but it works when notification function of firecloud
  • Jeric John Romero
    Jeric John Romero over 6 years
    I see. Keys may be messed up in the app. Not so sure how to do this, but I'll ask the mobile devs for this.
  • ehacinom
    ehacinom over 5 years
    I had this error, and I think it's that the FCMToken that I received from the mobile app (which got it from firebase) that I had saved to my backend was wrong, and saving the correct token fixed this error
  • kk.
    kk. almost 3 years
    This should be a comment and not an answer.