Logging in through Rocket.Chat's REST API and expecting the web browser to not require you to login again requires a few more steps.
When you authenticate with the REST API successfully the resulting object looks like (these are from a local development server):
{
"status": "success",
"data": {
"authToken": "t2hjaCXP397DxwnYAgQtEaAULDjo4S5vXkopLr04LZL",
"userId": "Q4KzBWSGtcCiKTtvC"
}
}
From this result, you will need to take the authToken
and set your in your web browser's LocalStorage Meteor.loginToken
with the value of authToken
. For example in this case, we would do the following:
var authToken = 'cXvkTF8X4uu-J_2uWelJGt4iuuTxjD5pFHuqhLOQRLJ';
localStorage.setItem('Meteor.loginToken', authToken);
Shortly after doing that, your Rocket.Chat screen should refresh and now you are logged in.