首页 > 解决方案 > Getstream.io 在使用“to”字段时抛出异常

问题描述

我有两个平面 Feed 组,main主要新闻 Feed 和main_topics.

我可以成功地向任何一个发帖。

但是当我尝试使用该to字段“抄送”另一个时,to: ["main_topics:donuts"]我得到:

code: 17
detail: "You do not have permission to do this, you got this error because there are no policies allowing this request on this application. Please consult the documentation https://getstream.io/docs/"
duration: "0.16ms"
exception: "NotAllowedException"
status_code: 403

日志:

该请求没有正确的权限或授权。请查看我们的文档以了解如何签署请求。

我们在服务器端生成用户令牌,并且该令牌可以在没有to.

// on server
stream_client.user(user.user_id).create({
  name: user.name,
  username: user.username,
});

帖子正文:

actor: "SU:5f40650ad9b60a00370686d7"
attachments: {images: [], files: []}
foreign_id: "post:1598391531232"
object: "Newsfeed"
text: "Yum #donuts"
time: "2020-08-25T14:38:51.232"
to: ["main_topics:donuts", "main_topics:all"]
verb: "post"

文档显示了一个示例,to: ['team:barcelona', 'match:1'],并说您需要在面板中创建提要组,但没有提及设置特定权限以使用此功能。

知道为什么会发生这种情况吗?请注意,我正在尝试创建发布此帖子时不存在的新主题(甜甜圈,所有)。但是,文档没有指定需要首先明确创建提要 - 也许这是缺少的部分?

标签: hashtaggetstream-io

解决方案


如果您尚未尝试先创建提要,请尝试。除此之外,默认权限限制用户在其他人的提要上发帖。我认为如果它是通知提要而不是用户或时间线,那么这样做是可以接受的。

您可以通过电子邮件向 getstream 支持发送电子邮件以更改默认权限,因为这些权限无法从仪表板进行管理。

或者您可以将此调用服务器端作为管理员权限。


推荐阅读