该请求缺少Firebase中带有推送通知的身份验证密钥

时间:2020-08-13 07:40:46

标签: firebase rest postman

我正在尝试通过Postman通过REST API Firebase为特定用户发送推送通知,我遵循以下请求模式:

带有以下 URL 的POST请求:

https://fcm.googleapis.com/fcm/send?key=**my Web API密钥**

身体

{“数据”: { “ title”:“ Firebase通知”, “ detail”:“我是Firebase通知。您可以自定义我。请享受” }, “至”:“ 用户UID ” }

但是问题在于它返回了The request was missing an Authentication Key.

1 个答案:

答案 0 :(得分:2)

请按照以下步骤操作:

  • API URL:https://fcm.googleapis.com/fcm/send/

  • 请求方法发布

  • 在“标头”部分添加2个键值对

    Content-Type : application/json
    Authorization: key=[Your server key] (Make sure that no space allowed)
    
  • 对于正文,请选择原始数据(JSON)

      { "data": { "title": "Firebase notification", "detail": "I am firebase notification. you can customise me. enjoy" }, "to" : "USER UID" }