带邮递员的FCM - 请求缺少认证密钥(FCM令牌) [英] FCM with Postman - The request was missing an Authentication Key (FCM Token)
问题描述
// body this like this
<$
to:
/ topics / NEWS
,
data:{
extra_information :这是一些额外的信息
},
//通知我需要给
$ $ $ $ code $通知
$ title $ ch $ c $ b $ text $ $ :您可能有新消息,
click_action:ChatActivity
code $ pre
401错误与您的授权密钥无效或不正确。
,为Authorization的值添加 key =
前缀,如下所示:
key = AAA ...
此外,对于您的通知
消息有效负载, text
不是有效的参数之一,我认为你正在寻找 message
。
使用邮递员发送下游邮件
要在
注意:始终保密您的服务器密钥。只有我的钥匙的一部分在这里是可见的所以它应该是罚款。
$(2)
(3)
< img src =https://i.stack.imgur.com/aZhso.pngalt =在这里输入图片描述>
请注意,请求在响应中 message_id
成功。
//body its like this
{
"to":
"/topics/NEWS"
,
"data":{
"extra_information": "This is some extra information"
},
//notification that i need to give
"notification":{
"title": "ChitChat Group",
"text": "You may have new messages",
"click_action":"ChatActivity"
}
}
The 401 error pertains that your Authorization Key is invalid or incorrect.
When using Postman, add a key=
prefix for the value of Authorization, like so:
key=AAA...
See below for a tutorial on Sending Downstream FCM Messages using Postman.
Also, for your notification
message payload, text
isn't one of the valid parameters, I think you were looking for message
instead.
Sending Downstream Messages using Postman
To do this in Postman, you simply have to set the following:
- Set request type to
POST
- In the Headers, set the following:
- Content-Type = application/json
- Authorization = < Your FCM Server Key > (See your Firebase Console's Cloud Messaging Tab)
- Set the payload parameters in the Body (*in this example, we used the raw option, see screenshot (2)*)
- Send the request to https://fcm.googleapis.com/fcm/send
Screenshots:
(1)
Note: Always keep your Server Key a secret. Only a portion of my key is visible here so it should be fine.
(2)
(3)
Notice that the request was a success with the message_id
in the response.
这篇关于带邮递员的FCM - 请求缺少认证密钥(FCM令牌)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!