I need to send web push notification using fcm v1 service using the below curl command.
curl --location --request POST 'https://fcm.googleapis.com/v1/projects/<project-id>/messages:send' \
--header 'Authorization: Bearer <Oauth token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"message": {
"token": "fcm-token",
"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"
}
}
}'
getting this response as below :
{
"error": {
"code": 401,
"message": "Auth error from APNS or Web Push Service",
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "THIRD_PARTY_AUTH_ERROR"
}
]
}
}
Not able to figure out the issue for web notifications, any suggestion ?
Tried solution from these two posts : https://medium.com/@ThatJenPerson/authenticating-firebase-cloud-messaging-http-v1-api-requests-e9af3e0827b8