问题
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