使用curl通过firebase云消息发送数据推送通知



我试图发送仅限数据的推送通知,但我在查找Authorization kye时遇到问题,而令牌witch是消息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"
}
}
]
}
}

最好使用遗留模式。v1模式需要访问令牌。

如何在firebase FCM 中启用遗留模式

相关内容

  • 没有找到相关文章

最新更新