aboutsummaryrefslogtreecommitdiffstats
path: root/lib/oauthbearer.go
diff options
context:
space:
mode:
authorR Chowdhury <necaris@gmail.com>2020-05-26 07:29:58 -0400
committerReto Brunner <reto@labrat.space>2020-08-13 07:44:43 +0200
commitf4dc7e1f746582d42462ec56347dd354756203b0 (patch)
treed4535b0aeecd9d323f12fcf1e3040babdbc79da1 /lib/oauthbearer.go
parentf1a0fd20d6d30fb1203ffa3cb9f4004476acfdb3 (diff)
downloadaerc-f4dc7e1f746582d42462ec56347dd354756203b0.tar.gz
Add `oauthbearer` support for SMTP
This piggybacks on the existing IMAP support, and uses the same configuration format (my local testing example has the IMAP and SMTP lines almost copy-pasted from one another). It's a little clumsy in that a new token is negotiated for every `Send()` command, but it's a start...
Diffstat (limited to 'lib/oauthbearer.go')
-rw-r--r--lib/oauthbearer.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/oauthbearer.go b/lib/oauthbearer.go
index 5bcba603..1030696e 100644
--- a/lib/oauthbearer.go
+++ b/lib/oauthbearer.go
@@ -13,7 +13,7 @@ type OAuthBearer struct {
Enabled bool
}
-func (c *OAuthBearer) exchangeRefreshToken(refreshToken string) (*oauth2.Token, error) {
+func (c *OAuthBearer) ExchangeRefreshToken(refreshToken string) (*oauth2.Token, error) {
token := new(oauth2.Token)
token.RefreshToken = refreshToken
token.TokenType = "Bearer"
@@ -26,7 +26,7 @@ func (c *OAuthBearer) Authenticate(username string, password string, client *cli
}
if c.OAuth2.Endpoint.TokenURL != "" {
- token, err := c.exchangeRefreshToken(password)
+ token, err := c.ExchangeRefreshToken(password)
if err != nil {
return err
}