在 Getstream-io Feed 更新中将“SU:”添加到 Actor 前面

rbi*_*nun 6 getstream-io

为什么必须SU:在 getstream-io feed 更新中添加 actor ID?

data = {'actor'  : 'SU:ronald',      
        'message': 'hello',          
        'object' : 'object',
        'verb'   : 'post'
        }
Run Code Online (Sandbox Code Playgroud)

如果没有SU:我得到错误:The policy "Don't impersonate other users" (900) blocked this request

{'detail': 'The policy "Don\'t impersonate other users" (900) blocked this request, please consult the documentation https://getstream.io/docs/',
 'status_code': 403,
 'code': 17,
 'exception': 'NotAllowedException',
 'duration': '0.17ms'}
Run Code Online (Sandbox Code Playgroud)

rbi*_*nun 0

我从 Stream.io 支持处得到的答案...

我们在 Stream API 中为 userID 添加前缀。 SU:前缀表示流用户引用,这样当您调用丰富端点来读取提要时,它将用引用的用户对象替换字符串。演员冒号规则适用于前缀,并且只需忽略常规精确字符串匹配的规则。