gpt4 book ai didi

firebase-cloud-messaging - 缺少 FCM token

转载 作者:行者123 更新时间:2023-12-04 02:39:31 24 4
gpt4 key购买 nike

我正在尝试使用 Postman 测试 FCM,但即使 FCM token 在那里,我也总是收到以下错误。我在 Cloud Messaging 选项卡中获得了 token :Firebase Cloud Messaging token 。

<HTML>
<HEAD>
<TITLE>The request was missing an Authentification Key (FCM Token). Please, refer to section &quot;Authentification&quot; of the FCM documentation, at https://firebase.google.com/docs/cloud-messaging/server.</TITLE>
</HEAD>

这是我发送的内容。
POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com
Cache-Control: no-cache
Postman-Token: 9109eb13-245f-0786-21a5-6207f5426b44

Content-Type:application/json
Authorization:key=AAAAfnYrKvU:APA91bFwgeM3zuFId6UDzvIHk9qZ3lKHnX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
{ "data": { "message": "This is a Firebase Cloud Messaging Topic Message!", } }:

最佳答案

花了几个小时后,我发现在 Postman 中,您必须将以下内容放入标题中。

Key: Content-Type
Value: application/json
Key: Authorization
Value: key=AAAAfnYrKvU:APA91bFwgeM3zuFId6UDzvIHk9qZ3lKHnX-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
(Firebase Cloud Messaging token)

然后单击 Body 并选择 Raw,在这里添加 json。
    {
"data": {
"title": "new messages",
"score": "5x1",
"time": "15:10"
},
"to": "/topics/alldevices"
}

我还发现您不能通过消除“to”来发送到所有设备:您必须让您的应用订阅一个主题。就我而言,我让我的应用订阅了“alldevices”。

现在我可以发送 "to":"/topics/alldevices"并且所有应用程序都会收到通知。

关于firebase-cloud-messaging - 缺少 FCM token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40856990/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com