From 4ed8836a71ab1d745a75e2aa8bf889eeb9dbba03 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 4 Oct 2015 22:06:53 +0100 Subject: [PATCH] oauthutil: add RedirectPublicURL --- oauthutil/oauthutil.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/oauthutil/oauthutil.go b/oauthutil/oauthutil.go index 10cb61d55..4bb5d699e 100644 --- a/oauthutil/oauthutil.go +++ b/oauthutil/oauthutil.go @@ -30,11 +30,17 @@ const ( // prompting the user to copy the code and paste it in the application. TitleBarRedirectURL = "urn:ietf:wg:oauth:2.0:oob" - // BindAddress is binding for local webserver when active - bindAddress = "127.0.0.1:53682" + // bindPort is the port that we bind the local webserver to + bindPort = "53682" + + // bindAddress is binding for local webserver when active + bindAddress = "127.0.0.1:" + bindPort // RedirectURL is redirect to local webserver when active RedirectURL = "http://" + bindAddress + "/" + + // RedirectPublicURL is redirect to local webserver when active with public name + RedirectPublicURL = "http://localhost.rclone.org:" + bindPort + "/" ) // oldToken contains an end-user's tokens. @@ -190,7 +196,7 @@ func Config(name string, config *oauth2.Config) error { // Detect whether we should use internal web server useWebServer := false switch config.RedirectURL { - case RedirectURL: + case RedirectURL, RedirectPublicURL: useWebServer = true case TitleBarRedirectURL: fmt.Printf("Use auto config?\n")