How to use Getstream Rest API to get response in Postman?

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-17 09:42:17

问题


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

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>

But I am getting this response on hitting API on Postman:

{ "code": 17, "message": "ListChannelTypes failed with error: \"Channel types can be described only with server-side auth\"", "StatusCode": 403, "duration": "0.00ms" }

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.


回答1:


As described in error message:

Channel types can be described only with server-side auth

It's only possible with server side authentication.

When you use Authorization: <Getstream token (generating from setUser function) from backend>, this is for client-side.

You need to use your secret in the token to enable server-side and to gueary in this endpoint.



来源:https://stackoverflow.com/questions/62132187/how-to-use-getstream-rest-api-to-get-response-in-postman

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!