问题描述
我正在尝试实现 Stream chat Rest API(通过以下链接:https://getstream.io/chat/docs_rest )由 GetStream 提供.因此,我将 baseUrl 和预期的标头以下列方式放置:
I am trying to implement Stream chat Rest APIs ( by following this link : https://getstream.io/chat/docs_rest ) provided by GetStream. So, I put the baseUrl and expected headers in following ways :
Request Url : https://chat-us-east-1.stream-io-api.com/channeltypes
这些是我在 Postman 的 Headers 部分中输入的值:
These are the values which I put in Headers section of Postman :
Authorization : <Getstream token (generating from setUser function) from backend>
Stream-Auth-Type: jwt
api_key : <Getstream API key>
但我在使用 Postman 上的 API 时收到此响应:
But I am getting this response on hitting API on Postman:
{代码":17,"message": "ListChannelTypes failed with error: "频道类型只能用服务器端认证描述"",状态代码":403,持续时间":0.00ms"}
我无法找出我在使用 Getstream 的 Rest API 时遗漏了什么或做错了什么.请提出建议并帮助解决此问题.
I am unable to find out what I am missing or doing wrong in using the Rest API of Getstream. Please suggest and help in fixing this issue.
推荐答案
如错误信息所述:
频道类型只能使用服务器端身份验证来描述
只有通过服务器端身份验证才有可能.
It's only possible with server side authentication.
当您使用 Authorization: <Getstream token (generating from setUser function) from backend>
时,这是针对客户端的.
When you use Authorization: <Getstream token (generating from setUser function) from backend>
, this is for client-side.
您需要在令牌中使用您的秘密来启用服务器端并在此端点中进行 gueary.
You need to use your secret in the token to enable server-side and to gueary in this endpoint.
这篇关于如何使用 Getstream Rest API 在 Postman 中获取响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!