aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/auth.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/client/auth.go b/client/auth.go
index 136ace0..9ea1ece 100644
--- a/client/auth.go
+++ b/client/auth.go
@@ -25,8 +25,9 @@ func NewOauthClient(clientId, clientSecret, tokenFile string, authFn authCodeFn)
return nil, err
}
- // Request auth code if token does not exist
- if !exists {
+ // Require auth code if token file does not exist
+ // or refresh token is missing
+ if !exists || token.RefreshToken == "" {
authUrl := conf.AuthCodeURL("state", oauth2.AccessTypeOffline)
authCode := authFn(authUrl)()
token, err = conf.Exchange(oauth2.NoContext, authCode)