1
0
mirror of https://github.com/rclone/rclone.git synced 2025-01-19 04:47:54 +02:00

oauthutil: add RedirectPublicURL

This commit is contained in:
Nick Craig-Wood 2015-10-04 22:06:53 +01:00
parent 5529978fa7
commit 4ed8836a71

@ -30,11 +30,17 @@ const (
// prompting the user to copy the code and paste it in the application. // prompting the user to copy the code and paste it in the application.
TitleBarRedirectURL = "urn:ietf:wg:oauth:2.0:oob" TitleBarRedirectURL = "urn:ietf:wg:oauth:2.0:oob"
// BindAddress is binding for local webserver when active // bindPort is the port that we bind the local webserver to
bindAddress = "127.0.0.1:53682" 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 is redirect to local webserver when active
RedirectURL = "http://" + bindAddress + "/" 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. // 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 // Detect whether we should use internal web server
useWebServer := false useWebServer := false
switch config.RedirectURL { switch config.RedirectURL {
case RedirectURL: case RedirectURL, RedirectPublicURL:
useWebServer = true useWebServer = true
case TitleBarRedirectURL: case TitleBarRedirectURL:
fmt.Printf("Use auto config?\n") fmt.Printf("Use auto config?\n")