[英]Using curl to send data push notification with firebase cloud messaging
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.我正在尝试仅发送数据推送通知,但我无法找到授权 kye 并且令牌女巫是消息 json。对于从何处获取此值,我从 firebase 控制台中搜索并尝试所有操作。有另一种发送数据的方式仅推送通知。我的要求是否正确。谢谢。
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"
}
}
]
}
}
It is better you used of legacy mode.最好使用传统模式。 v1 mode need access token.
v1 模式需要访问令牌。
how enable legacy mode in firebase FCM如何在 firebase FCM 中启用传统模式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.