Using curl to send data push notification with firebase cloud messaging

Viewed 53

I am trying to send data only push notification but I have problem finding the Authorization kye and the token witch is is message json.For where to get this values I search and try all from firebase console.Is have another way to send data only push notification.Do my request is right bulded.Thank you.

  curl -X POST https://fcm.googleapis.com/v1/projects/projectID/messages:send  -H    "Application/json" -H "Content-type: application/json" -H "Authorization: key={For where to get the key}" -d '{"message":"token":"{where to get token}",{"data"{"customData":"2dfs2"}}}'

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "CREDENTIALS_MISSING",
        "domain": "googleapis.com",
        "metadata": {
          "service": "fcm.googleapis.com",
          "method": "google.firebase.fcm.v1.FcmService.SendMessage"
        }
      }
    ]
  }
}
1 Answers
Related