Search code examples
rubyjwthttpartygetstream-io

Action permission error with Stream API


I keep getting "You do not have permission to perform this action." when attempting to connect. What am I missing?

url = 'https://api.getstream.io/api/v1.0/feed/user/12353253/?api_key=API_KEY'

payload = {
  'resource' => 'feed',
  'action' => 'read',
  'feed_id' => 'user:12353253'
}

token = JWT.encode(payload, secret, 'HS256')

options[:headers] = {
  'Authorization' => token,
  'stream-auth-type' => 'jwt'
}

response = HTTParty.get(url, options)

Solution

  • It looks like you got everything right except for the value for feed_id in the payload. It should be the "user12353253" instead of "user:12353253" (no semicolon).

    P.S. I am one of the founders of Stream, REST API does not explain this well. We will update them asap.