From 7f9a400776e0000c84e6539a932027965098d6a3 Mon Sep 17 00:00:00 2001 From: Wim Date: Wed, 23 Aug 2017 22:49:42 +0200 Subject: Add support for personal access tokens (mattermost) * https://docs.mattermost.com/developer/personal-access-tokens.html --- matterclient/matterclient.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'matterclient/matterclient.go') diff --git a/matterclient/matterclient.go b/matterclient/matterclient.go index f2ae46b0..53c7809c 100644 --- a/matterclient/matterclient.go +++ b/matterclient/matterclient.go @@ -140,7 +140,7 @@ func (m *MMClient) Login() error { for { m.log.Debugf("%s %s %s %s", logmsg, m.Credentials.Team, m.Credentials.Login, m.Credentials.Server) if strings.Contains(m.Credentials.Pass, model.SESSION_COOKIE_TOKEN) { - m.log.Debugf(logmsg+" with %s", model.SESSION_COOKIE_TOKEN) + m.log.Debugf(logmsg + " with token") token := strings.Split(m.Credentials.Pass, model.SESSION_COOKIE_TOKEN+"=") if len(token) != 2 { return errors.New("incorrect MMAUTHTOKEN. valid input is MMAUTHTOKEN=yourtoken") @@ -150,7 +150,7 @@ func (m *MMClient) Login() error { m.Client.AuthType = model.HEADER_BEARER m.User, resp = m.Client.GetMe("") if resp.Error != nil { - return errors.New(resp.Error.DetailedError) + return resp.Error } if m.User == nil { m.log.Errorf("LOGIN TOKEN: %s is invalid", m.Credentials.Pass) -- cgit v1.2.3