RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
39.62k stars 10.15k forks source link

Open chat on webview with logged user #13690

Open lucianoborgesumovme opened 5 years ago

lucianoborgesumovme commented 5 years ago

Hi,

I'm trying to open RocketChat on webview on my Android App (I know that there is a native app, but a want to use a webview at this moment because I will use LiveChat mode to - available only on web) with the user already logged in. The first step that I did was to call the method "/api/v1/login" to get the userId and authToken. After that, is not clear for me how does can I use these fields on RocketChat call.

I've tried to use Headers ("X-User-Id" and "X-Auth-Token") but does not work.

My target is simple: I just want make a call (as this call, for instance: "https://domain/token/authToken) and shows RocketChat with the current user logged in.

Is it possible to do this?

Thank you very much

goodjun commented 3 years ago

you can try:

set token in local storage.

javascript code:

window.localStorage.setItem('Meteor.loginToken', webToken)