gpt4 book ai didi

firebase - FCM with Postman - 请求缺少身份验证 key (FCM token )

转载 作者:行者123 更新时间:2023-12-03 08:50:38 25 4
gpt4 key购买 nike

enter image description here

// body 就像这样

{
"to":
"/topics/NEWS"
,
"data":{
"extra_information": "This is some extra information"
},

//我需要给出的通知
"notification":{
"title": "ChitChat Group",
"text": "You may have new messages",
"click_action":"ChatActivity"
}
}

最佳答案

401 错误与您的授权 key 无效或不正确有关。

使用 Postman 时,添加 key= Authorization 值的前缀,如下所示:

key=AAA...

有关使用 Postman 发送下游 FCM 消息的教程,请参见下文。

另外,对于您的 notification消息负载, text不是有效参数之一,我想您正在寻找 message反而。



使用 Postman 发送下游消息

Postman 中执行此操作,您只需设置以下内容:
  • 将请求类型设置为 POST
  • 在标题中,设置以下内容:
  • 内容类型 = 应用程序/json
  • 授权 = <您的 FCM 服务器 key >(查看您的 Firebase Console's Cloud Messaging Tab)
  • 在正文中设置有效负载参数(*在此示例中,我们使用了原始选项,请参见屏幕截图(2)*)
  • 将请求发送至 https://fcm.googleapis.com/fcm/send

  • 截图:

    (1)
    enter image description here

    备注 :始终将您的服务器 key 保密。这里只能看到我的 key 的一部分,所以应该没问题。

    (2)
    enter image description here

    (3)
    enter image description here

    请注意,请求成功, message_id在回应中。

    关于firebase - FCM with Postman - 请求缺少身份验证 key (FCM token ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45309674/

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