TransWikia.com

Firebase Cloud Messaging cURL POST showing error 403

Stack Overflow Asked by Sparsha Dhar on September 26, 2020

I am new to cURL and Firebase. I’m trying to send a FCM test message using Powershell with the following code from https://firebase.google.com/docs/cloud-messaging/js/first-message#curl (I had to fix the position of one closing bracket)

This is the code I am using-

curl -X POST -H "Authorization: Bearer ya29.c.KpAB...." -H "Content-Type: application/json" -d '{
  "message":{
    "notification": {
      "title": "FCM-Message",
      "body": "This-is-a-message-from-FCM"
    },
    "webpush": {
      "headers": {
        "Urgency": "high"
      },
      "notification": {
        "body": "This-is-a-message-from-FCM-to-web",
        "requireInteraction": "true",
        "badge": "/badge-icon.png"
      }
    },
    "token": "fG7.....",
  }
}' https://fcm.googleapis.com/v1/projects/project-f0994/messages:send

But for some reason I am getting this error:

{
  "error": {
    "code": 403,
    "message": "Request had insufficient authentication scopes.",
    "status": "PERMISSION_DENIED"
  }
}

I can’t figure out what I might be doing wrong. Thanks.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP