Skip to content

Commit

Permalink
Actually use the option to disable the interactive prompt.
Browse files Browse the repository at this point in the history
  • Loading branch information
singhsays committed May 13, 2014
1 parent 377a493 commit f14443b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package auth

import (
"code.google.com/p/goauth2/oauth"
"errors"
"fmt"
"github.com/prasmussen/gdrive/util"
"net/http"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f14443b

Please sign in to comment.