FCM Auth error from APNS or Web Push Service : 401 - on web push notification

1000 views Asked by At

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

https://apoorv487.medium.com/testing-fcm-push-notification-http-v1-through-oauth-2-0-playground-postman-terminal-part-2-7d7a6a0e2fa0

0

There are 0 answers