From 9b320cd43fc77bd537660818d050285ee05cca14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Such=C3=A1nek?= Date: Fri, 13 Sep 2019 23:41:02 +0200 Subject: [PATCH] Add token support (RocketChat) (#892) Signed-off-by: Michal Suchanek --- bridge/rocketchat/helpers.go | 3 +++ matterbridge.toml.sample | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/bridge/rocketchat/helpers.go b/bridge/rocketchat/helpers.go index 9fca4a6d..936f631c 100644 --- a/bridge/rocketchat/helpers.go +++ b/bridge/rocketchat/helpers.go @@ -58,6 +58,9 @@ func (b *Brocketchat) doConnectWebhookURL() error { func (b *Brocketchat) apiLogin() error { b.Log.Debugf("handling apiLogin()") credentials := &models.UserCredentials{Email: b.GetString("login"), Password: b.GetString("password")} + if b.GetString("Token") != "" { + credentials = &models.UserCredentials{ID: b.GetString("Login"), Token: b.GetString("Token")} + } myURL, err := url.Parse(b.GetString("server")) if err != nil { return err diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index de75c8df..61c86176 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -956,6 +956,11 @@ Server="https://yourrocketchatserver.domain.com:443" #REQUIRED (when not using webhooks) Login="yourlogin@domain.com" Password="yourpass" +# When using access token set Login to the User ID associated with your token and Token to your token. +# When Token is set Password is ignored. +# Login="yOurUSerID" +# Token="YoUrUsER_toKEN" + #### Settings for webhook matterbridge. #USE DEDICATED BOT USER WHEN POSSIBLE! This allows you to use advanced features like message editing/deleting and uploads