Reputation: 914
I am using Google's OAuth 2.0 Playground to test a Firebase messaging component on an app. The process is quite straightforward: I select the API's I want, login using my Gmail - on which I have my project defined - which gets me the Authorization token - which I then convert to an Access Token.
POST /v1/projects/trustedhouseapp1/messages:send HTTP/1.1
Host: fcm.googleapis.com
Content-length: 412
Content-type: application/json
Authorization: Bearer ya29.a0ARW5m74OR8QhycmZgsY5h3Vk-mZw7fTlU65L3IXM0Gx4jIjT83vDYP4_ek....
I change the method to POST and enter the URI:
https://fcm.googleapis.com/v1/projects/<projectname>/messages:send
and then enter the request body as:
{
"message": {
"token": "cr273sbdTNCfvbpo_itHfk:APA91bGZFe2Qjq....",
"data": {
"body": "Body of Your Notification in data",
"title": "Title of Your Notification in data",
"key_1": "Value for key_1",
"key_2": "Value for key_2"
}
}
}
The response I then get is:
HTTP/1.1 403 Forbidden
Content-length: 262
X-xss-protection: 0
X-content-type-options: nosniff
Transfer-encoding: chunked
Vary: Origin, X-Origin, Referer
Server: scaffolding on HTTPServer2
-content-encoding: gzip
Date: Mon, 13 Jan 2025 14:53:30 GMT
X-frame-options: SAMEORIGIN
Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Content-type: application/json; charset=UTF-8
{
"error": {
"status": "PERMISSION_DENIED",
"message": "SenderId mismatch",
"code": 403,
"details": [
{
"errorCode": "SENDER_ID_MISMATCH",
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError"
}
]
}
}
I know that in a production environment I would had had to upload the service account json to the server that is sending the notification, but that is not possible on the Playground.
So where would i even start by trying to check/change the SenderId?
Upvotes: 0
Views: 19