aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Rasmussen2016-01-16 18:24:31 +0100
committerPetter Rasmussen2016-01-16 22:09:46 +0100
commitf2ab00ce73744c95a986100784ec4af92cd83c33 (patch)
treef27f99d20ecb60a852315c724cffc4edbbacb42b
parent784dd2128197236b5b0dfb08e8f0ca41ca723e87 (diff)
downloadgdrive-f2ab00ce73744c95a986100784ec4af92cd83c33.tar.bz2
Check for missing refresh token
-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)