From 2e9f2ea3d353f3ee822e858ee7c94caa94cb03d2 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 2 Oct 2015 21:06:11 +0100 Subject: [PATCH] oauthutil: fix headless config for drive and gcs - fixes #158 --- oauthutil/oauthutil.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/oauthutil/oauthutil.go b/oauthutil/oauthutil.go index 77791dba4..10cb61d55 100644 --- a/oauthutil/oauthutil.go +++ b/oauthutil/oauthutil.go @@ -197,10 +197,12 @@ func Config(name string, config *oauth2.Config) error { fmt.Printf(" * Say Y if not sure\n") fmt.Printf(" * Say N if you are working on a remote or headless machine or Y didn't work\n") useWebServer = fs.Confirm() - // copy the config and set to use the internal webserver - configCopy := *config - config = &configCopy - config.RedirectURL = RedirectURL + if useWebServer { + // copy the config and set to use the internal webserver + configCopy := *config + config = &configCopy + config.RedirectURL = RedirectURL + } } // Make random state