使用 Firebase 消息通过 Postman 发送推送 [英] Sending Push via Postman using Firebase Messaging

查看:24
本文介绍了使用 Firebase 消息通过 Postman 发送推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

2- 在 Body ,我正在使用 raw

<代码>{到":<YOUR_DEVICE_ID_TOKEN>",通知": {body":Firebase 云消息"}}

执行时,我返回 401 - Unauthorized.

正确发送推送通知缺少什么?

解决方案

在Header处设置Authorization键的正确方法是

key=<API_ACCESS_KEY>

不仅如此

<API_ACCESS_KEY>

愚蠢的错误,但由于这对于使用 Postman 测试 Firebase 消息传递的人可能有用,所以我将问题留待解决.

I'm trying to use Postman to send a single Push Notification using Firebase Cloud Messaging service.

This is a working cURL command for the same purposal, on which I'm using as a reference.

curl -X POST --header "Authorization: key=<API_ACCESS_KEY>" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{"to":"<YOUR_DEVICE_ID_TOKEN>","notification":{"body":"Firebase"} "priority":"10"}"

What I have done so far..

1 - Set the Headers appropriately

2- At Body , I'm using raw

{
    "to" : "<YOUR_DEVICE_ID_TOKEN>"
    , 

    "notification": {
    "body": "Firebase Cloud Message"
  }

  }

When executing, I'm getting back 401 - Unauthorized.

What's missing to correctly send the push notification?

解决方案

The correct way to set up Authorization key at Header is

key=<API_ACCESS_KEY>

and not only

<API_ACCESS_KEY>

Silly mistake, but since this could be useful for someone for testing Firebase Messaging with Postman I'm leaving the question opened.

这篇关于使用 Firebase 消息通过 Postman 发送推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆