diff options
Diffstat (limited to 'commands/compose')
-rw-r--r-- | commands/compose/send.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go index 7306bef8..9edb168e 100644 --- a/commands/compose/send.go +++ b/commands/compose/send.go @@ -325,14 +325,13 @@ func newSaslClient(auth string, uri *url.URL) (sasl.Client, error) { OAuth2: oauth2, Enabled: true, } - if bearer.OAuth2.Endpoint.TokenURL == "" { - return nil, fmt.Errorf("No 'TokenURL' configured for this account") - } - token, err := bearer.ExchangeRefreshToken(password) - if err != nil { - return nil, err + if bearer.OAuth2.Endpoint.TokenURL != "" { + token, err := bearer.ExchangeRefreshToken(password) + if err != nil { + return nil, err + } + password = token.AccessToken } - password = token.AccessToken saslClient = sasl.NewOAuthBearerClient(&sasl.OAuthBearerOptions{ Username: uri.User.Username(), Token: password, |