Hi everyone,
I am helping the op (Stefan) work on this project. I can easily extract the annotations he talks about via the app's API or via a RSS feed. So getting them is not a problem. I am hitting a wall when trying to post those annotations' links and text to a Rocket chat channel that living in a Rocket chat Sandstorm grain.
I am trying to use Rocket chat's REST API as documented here:
https://rocket.chat/docs/developer-guides/rest-api/ and following the Sandstorm docs (
https://docs.sandstorm.io/en/latest/developing/http-apis/) to get the API requests through Sandstorm to the Rocket chat grain.
Using curl to test, I manage to get the API version and to do an initial login into Rocket chat, which tells me the API calls work, they get through to the right grain:
Request:
curl -H "Authorization: Bearer <my_api_token_from_the_sandstorm_grain"
https://api-<my_unique_sandstorm_endpoint>.my.domain/api/login -d "user=
rocket.cat&password=secretpassword"
Reply:
{
"status": "success",
"data": {
"authToken": "my_rocket_chat_token",
"userId": "
rocket.cat"
}
Then when I try to do any other authenticated api request with the above username and token, it fails:
Request:
curl -H "Authorization: Bearer <my_api_token_from_the_sandstorm_grain>" -H "X-Auth-Token: <my_rocket_chat_token>" -H "X-User-Id:
rocket.cat"
https://api-<my_unique_sandstorm_endpoint>.my.domain/api/publicRooms
Reply:
{
"status": "error",
"message": "You must be logged in to do this."
}
Any ideas? What am I missing?
Thanks,
Dan