Getstream获取提要时收到403 NotAllowedException错误

时间:2019-04-24 10:42:29

标签: permissions feed getstream-io

我正在尝试建立一个演示,以便用户可以获取有关其工作区中发生的事情的通知。 我使用notification类型的 notification 提要和flat

类型的 workspace 提要来塑造了这个模型

在getstream世界中,用户和工作区均由其ID标识

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

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 feed的应用程序中,以实时获取新通知,并检索最后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"}

可能是什么原因?

2 个答案:

答案 0 :(得分:0)

您看到有关此的教程了吗? https://getstream.io/docs/#notification-system

注意步骤3并创建只读令牌。那是什么吗?

答案 1 :(得分:0)

我为该应用程序生成了一个新的客户端令牌,并且此错误已修复

相关问题