RocketChat / Rocket.Chat.js.SDK

Utility for apps and bots to interact with Rocket.Chat via DDP and/or API
MIT License
136 stars 94 forks source link

Use SDK with personal access token #152

Open eloo opened 2 years ago

eloo commented 2 years ago

Hi,

i'm trying to get the sdk running with personal access token but it seems not to work. Is this a bug? Or should it be just not be possible to use the access token for the real-time api? At least this seems not be document anywhere

Thanks

eloo commented 2 years ago

At least in the Golang SDK i found an option to use the userId and token directy. Seems like this is missing here?

serjk commented 2 years ago

Hi @eloo It's weird and just workaround but you can use setAuth from api file after that call get/post functions to check your token. I've tested this approach and it works. https://github.com/RocketChat/Rocket.Chat.js.SDK/blob/master/src/lib/api.ts#L57