获取源时,Getstream 收到 403 NotAllowedException 错误



我正在尝试设置一个演示,用户可以在其中获得有关其工作区中发生的事情的通知。我使用类型 notification通知源和类型 flat工作区源塑造了此模型

用户和工作区在getstream世界中都通过其ID进行标识

用户的通知源遵循其工作区的工作区源。服务器端:

const client = stream.connect(apiKey, secret, appId)
const feed = client.feed('notification', userId).follow('workspace', workspaceId, (r, e) => console.log("result: ", r, "error: ", e))

然后在应用程序中,我想订阅通知提要以实时获取新通知,并检索最后 5 条通知以在下拉列表中显示它们(Facebook 样式(:

const streamClient = stream.connect(apiKey, token, appId)
notificationFeed = streamClient.feed('notification', userId)
subscription = notificationFeed.subscribe(handleNewEvents)
notificationFeed.get.get({mark_seen: true, limit: 5})

最后一个获取请求正在引发 403 错误:

{"detail":"You don't have permission to do this","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.10ms"}

可能是什么原因?

你看到这方面的教程了吗? https://getstream.io/docs/#notification-system

注意:步骤 3 并创建只读令牌。这就是缺少的吗?

我为应用程序生成了新的客户端令牌,这修复了错误

相关内容

  • 没有找到相关文章

最新更新