[英]I can not implement a Cloud Function that creates a topic in the firebase console
I am trying to implement a firebase function, which executes the creation of a topic in the firebase console.我正在尝试实现一个 firebase 函数,该函数在 firebase 控制台中执行主题的创建。
Here is mi code:这是我的代码:
exports.createGroupTopic = functions.database.ref("/FDSF/equipos/{equipoID}/").onWrite(event => {
let eventSnapshot = event.data;
let nombreEquipo = eventSnapshot.child('nombre').val();
console.log(nombreEquipo);
request({
method: 'POST',
url: 'https://iid.googleapis.com/iid/v1/IID_TOKEN/rel/topics/'+ nombreEquipo,
headers: {
'Content-Type':'application/json',
'Content-Length': 0,
'Authorization':'API_KEY'
}
}, ...
After performing the deploy, observing the output of the console, I get the following error:执行部署后,观察控制台的输出,我收到以下错误:
The value of the Authorization header is the server key prefixed by key=
, as shown in this example in the documentation : Authorization 标头的值是以key=
为前缀的服务器密钥,如文档中的此示例所示:
https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
Prefix your server key with key=
.使用key=
您的服务器密钥添加前缀。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.