FCM Push Notification: MismatchSenderId

Viewed 25517

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

7 Answers

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.

This error is due to invalid tokens I solved this, enter the token correctly

Posting FCM through POSTMAN

Authorization: key=YOUR-SERVER-KEY
Content-Type: application/json

enter image description here

Now click on Body than select Row and add value as object like below
Make sure Row is in JSON(application/json)

enter image description here

{
"to": "cpa8cZPjq-w:APA91bF122f1Rnhu9v47bL
YMajaNTHAIU5SzItDwTy9o2MCIveG0PlK78VPvp3d
CqjwnUKZ4
ngi1trSyM3_aXttW62iknFfbPGtjRLhZr6wq-3qFdboz8gzdOGPz**********",

"notification": {

"body": "Hello",
"title": "This is test message."
}
}

POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com

enter image description here

This problem simply means server and client used 2 different firebase projects. It most likely happens when you accidentally push wrong keys and mix up your Development, Staging or Production environments.

Steps to fix:

  1. Check your server make sure the keys in firebase admin / fcm matches your target environment
  2. Check your client make sure it's generating the push tokens using the same target environment

You can confirm the client environment against the server by sending a test push notification using the generated push token in your firebase console. You will only receive the test notification if the push token is used in the correct Firebase project.

Downloading google-services.json and GoogleService-info.plist files from the General tab of the Firebase console solved the problem.

1

Don't download the file that comes while creating the app. There might be chances for mismatching sender ids. So, the best way is to download the files from the general tab and place them in their respective folders.

2

Related