简体   繁体   English

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

[英]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.

相关问题 Firebase 云消息 - 手机收不到推送通知 - Firebase Cloud Messaging - Mobile not receiving push notification 使用 FCM(Firebase 云消息传递)通过 C# 将推送发送到 Android - Send push to Android by C# using FCM (Firebase Cloud Messaging) 如何使用 Firebase 云消息在 Twilio 上配置新的服务器密钥以进行推送通知 - How to configure new Server Key on Twilio using Firebase cloud messaging for push notification Firebase Cloud Messaging 静默推送通知无法正常工作 - Firebase Cloud Messaging Silent Push Notification fail to work 如何使用 Firebase Cloud Messaging 安排本地推送通知? - How do I schedule a local push notification with Firebase Cloud Messaging? Flutter - Firebase 使用 firebase 消息传递成功但未收到通知的推送通知 - Flutter - Firebase push notification using firebase messaging success but not get notification 在 Kotlin 客户端应用程序中发送 FCM 推送通知 - Firebase 云消息传递 - Sending FCM Push Notification in Kotlin Client App - Firebase Cloud Messaging 如何通过firebase云消息发送定时通知到flutter app - how to send scheduled notification to flutter app through firebase cloud messaging 使用 AWS SNS 和 firebase 云消息传递 (fcm) 发送推送通知有什么好处 - whats the benefits of using AWS SNS with firebase cloud messaging(fcm) to send push notifications Firebase 云消息删除通知 - Firebase Cloud Messaging deleting notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM