【问题标题】:The request was missing an Authentication Key with push notification in firebase该请求在 Firebase 中缺少带有推送通知的身份验证密钥
【发布时间】:2020-12-03 00:27:54
【问题描述】:

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

使用以下 URL 的 POST 请求:

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

而身体是

{ “数据”: { "title": "Firebase 通知", "detail": "我是 firebase 通知。你可以自定义我。享受" }, "to" : "用户 UID" }

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

【问题讨论】:

    标签: firebase rest postman


    【解决方案1】:

    请按照以下步骤操作:

    • API 网址:https://fcm.googleapis.com/fcm/send/

    • 请求方法发布

    • 像这样在 Header 部分添加 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" }
      

    【讨论】:

    • 但是告诉我这个应该在 URL 中指定一个有效的推送订阅端点
    • 在我也添加了 project_id 之前,请求不会通过。
    • 我无法理解您对上述评论的看法。请描述
    • 不需要project_id server key就足够了
    • 你可以像这样使用body { "notification": { "body": "this is a body", "title": "this is a title" }, "priority": "high ", "data": { "body": "这是一个正文", "title": "这是一个标题", "status": "done" }, "registration_ids": [ "device_fcm_token" ] }跨度>
    猜你喜欢
    • 1970-01-01
    • 2017-04-05
    • 1970-01-01
    • 1970-01-01
    • 2017-12-31
    • 2017-11-22
    • 1970-01-01
    • 2017-02-01
    • 2016-02-29
    相关资源
    最近更新 更多