【问题标题】:Getstream getting a 403 NotAllowedException error when getting the feedGetstream 在获取提要时收到 403 NotAllowedException 错误
【发布时间】:2019-04-25 17:32:14
【问题描述】:

我正在尝试设置一个演示,用户可以在其中收到有关其工作区中正在发生的事情的通知。 我用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"}

可能是什么原因?

【问题讨论】:

    标签: permissions feed getstream-io


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 我看过教程,但不认为只读令牌可以产生任何影响
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-21
      • 2018-05-28
      • 2020-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多