Add token support (RocketChat) (#892)

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
This commit is contained in:
Michal Suchánek 2019-09-13 23:41:02 +02:00 committed by Wim
parent 28783a4146
commit 9b320cd43f
2 changed files with 8 additions and 0 deletions

View File

@ -58,6 +58,9 @@ func (b *Brocketchat) doConnectWebhookURL() error {
func (b *Brocketchat) apiLogin() error { func (b *Brocketchat) apiLogin() error {
b.Log.Debugf("handling apiLogin()") b.Log.Debugf("handling apiLogin()")
credentials := &models.UserCredentials{Email: b.GetString("login"), Password: b.GetString("password")} 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")) myURL, err := url.Parse(b.GetString("server"))
if err != nil { if err != nil {
return err return err

View File

@ -956,6 +956,11 @@ Server="https://yourrocketchatserver.domain.com:443"
#REQUIRED (when not using webhooks) #REQUIRED (when not using webhooks)
Login="yourlogin@domain.com" Login="yourlogin@domain.com"
Password="yourpass" 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. #### Settings for webhook matterbridge.
#USE DEDICATED BOT USER WHEN POSSIBLE! This allows you to use advanced features like message editing/deleting and uploads #USE DEDICATED BOT USER WHEN POSSIBLE! This allows you to use advanced features like message editing/deleting and uploads