我正在尝试仅发送数据推送通知,但我在找到授权 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"
}
}
]
}
}