Getstream 在获取提要时出现 403 NotAllowedException 错误

Getstream getting a 403 NotAllowedException error when getting the feed

我正在尝试设置一个演示,用户可以在其中收到有关其工作区中发生的事情的通知。 我用 notification 类型 notification 提要和 workspace 类型 flat[= 提要塑造了这个模型15=]

用户和工作区都在 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))

然后在应用程序中我想订阅 notification 提要以实时获取新通知并检索最后 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 步并创建只读令牌。是不是少了什么?

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