diff options
| author | Sumit Arora | 2014-05-14 02:27:49 +1000 |
|---|---|---|
| committer | Sumit Arora | 2014-05-14 02:27:49 +1000 |
| commit | f14443b6e7b1d0c67332c4ceb3db0970d0d89705 (patch) | |
| tree | 52a0b9ebec26a3dbf6fd3b15db3971cba898c162 /auth | |
| parent | 377a4931b52666040d819d3c21d5eb88da8adcfa (diff) | |
| download | gdrive-f14443b6e7b1d0c67332c4ceb3db0970d0d89705.tar.bz2 | |
Actually use the option to disable the interactive prompt.
Diffstat (limited to 'auth')
| -rw-r--r-- | auth/auth.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/auth/auth.go b/auth/auth.go index 22267da..6bb14d6 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -2,6 +2,7 @@ package auth import ( "code.google.com/p/goauth2/oauth" + "errors" "fmt" "github.com/prasmussen/gdrive/util" "net/http" @@ -58,6 +59,10 @@ func GetOauth2Client(clientId, clientSecret, cachePath string, promptUser bool) return transport.Client(), nil } + if !promptUser { + return nil, errors.New("no valid token found") + } + // Get auth code from user and request a new token code := promptUserForAuthCode(config) _, err := transport.Exchange(code) |
