使用Firebase消息发送通过邮递员推送

编程入门 行业动态 更新时间:2024-10-27 06:30:00
本文介绍了使用Firebase消息发送通过邮递员推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正尝试使用

2-在身体,我正在使用 raw

{to:< YOUR_DEVICE_ID_TOKEN> , 通知:{body:Firebase Cloud Message} }

执行时,我回到 401 - 未经授权 / p>

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

解决方案

在头部设置授权键的方法是 $ b $ p $ key $< API_ACCESS_KEY> / code>

不只是

< API_ACCESS_KEY> / code>

愚蠢的错误,但是由于这可能对于测试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" fcm.googleapis/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消息发送通过邮递员推送

本文发布于:2023-10-29 04:17:21,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:邮递员   消息   Firebase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!