0

My objective is to send messages/notifications from a C# web app to Android/iOS device using Firebase Rest API.

I started using this as a reference: https://firebase.google.com/docs/cloud-messaging/http-server-ref

I went into the console for the Firebase project and went to Settings > Cloud Messaging, where I got the server key.

I have the result of a onTokenRefresh() and so in Postman I try the following:

POST https://fcm.googleapis.com/fcm/send
Content-Type: application/json
Authorization: key=snip
Body:

{
    "to":"snip",
    "data":{
        "Lorem": "ipsum"
    }
}

And the response is:

"error": "MismatchSenderId"

Is this because the token I used in the "to" field belongs to a different app/firebase project? Or am I missing another step?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
andrewb
  • 2,995
  • 7
  • 54
  • 95
  • Possible duplicate of [Firebase MismatchSenderID when Authorization key is my Server key](https://stackoverflow.com/questions/43244901/firebase-mismatchsenderid-when-authorization-key-is-my-server-key) – AL. Apr 27 '18 at 05:23

1 Answers1

0

Is this because the token I used in the "to" field belongs to a different app/firebase project?

Yes. This is probably the issue. If you used a google-services.json file from a different project and didn't authorize the other project to send to the corresponding token (see my answer about multiple senders here), then it would return MismatchSenderId.

AL.
  • 36,815
  • 10
  • 142
  • 281