From beea4d5119555c0424cf3bc8b3e67d625813b014 Mon Sep 17 00:00:00 2001 From: Ole Frost <82263101+olefrost@users.noreply.github.com> Date: Wed, 7 Dec 2022 20:44:28 +0100 Subject: [PATCH] lib/oauthutil: Improved usability of config flows needing web browser The config question "Use auto config?" confused many users and lead to recurring forum posts from users that were unaware that they were using a remote or headless machine. This commit makes the question and possible options more descriptive and precise. This commit also adds references to the guide on remote setup in the documentation of backends using oauth as primary authentication. --- cmd/config/config.go | 2 +- docs/content/amazonclouddrive.md | 7 ++++--- docs/content/box.md | 14 ++++++++------ docs/content/drive.md | 13 +++++++++---- docs/content/dropbox.md | 10 ++++++++++ docs/content/googlecloudstorage.md | 13 +++++++++---- docs/content/googlephotos.md | 13 +++++++++---- docs/content/hidrive.md | 5 ++++- docs/content/onedrive.md | 7 ++++--- docs/content/pcloud.md | 7 ++++--- docs/content/premiumizeme.md | 7 ++++--- docs/content/putio.md | 13 +++++++++---- docs/content/remote_setup.md | 22 ++++++++++++---------- docs/content/sharefile.md | 7 ++++--- docs/content/yandex.md | 7 ++++--- docs/content/zoho.md | 7 ++++--- lib/oauthutil/oauthutil.go | 2 +- 17 files changed, 100 insertions(+), 56 deletions(-) diff --git a/cmd/config/config.go b/cmd/config/config.go index 5fb21a0cf..e3b916aad 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -176,7 +176,7 @@ This will look something like (some irrelevant detail removed): "State": "*oauth-islocal,teamdrive,,", "Option": { "Name": "config_is_local", - "Help": "Use auto config?\n * Say Y if not sure\n * Say N if you are working on a remote or headless machine\n", + "Help": "Use web browser to automatically authenticate rclone with remote?\n * Say Y if the machine running rclone has a web browser you can use\n * Say N if running rclone on a (remote) machine without web browser access\nIf not sure try Y. If Y failed, try N.\n", "Default": true, "Examples": [ { diff --git a/docs/content/amazonclouddrive.md b/docs/content/amazonclouddrive.md index 2fd16db74..b0068f94f 100644 --- a/docs/content/amazonclouddrive.md +++ b/docs/content/amazonclouddrive.md @@ -79,9 +79,10 @@ Token server url - leave blank to use Amazon's. token_url> Optional token URL Remote config Make sure your Redirect URL is set to "http://127.0.0.1:53682/" in your custom config. -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y diff --git a/docs/content/box.md b/docs/content/box.md index 906d5d0ad..69b8676a6 100644 --- a/docs/content/box.md +++ b/docs/content/box.md @@ -57,9 +57,10 @@ Choose a number from below, or type in your own value \ "enterprise" box_sub_type> Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y @@ -176,9 +177,10 @@ Already have a token - refresh? y) Yes n) No y/n> y -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y diff --git a/docs/content/drive.md b/docs/content/drive.md index 922961ef4..80d20f42f 100644 --- a/docs/content/drive.md +++ b/docs/content/drive.md @@ -62,9 +62,10 @@ scope> 1 Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login. service_account_file> Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine or Y didn't work +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y @@ -91,8 +92,12 @@ d) Delete this remote y/e/d> y ``` +See the [remote setup docs](/remote_setup/) for how to set it up on a +machine with no Internet browser available. + Note that rclone runs a webserver on your local machine to collect the -token as returned from Google if you use auto config mode. This only +token as returned from Google if using web browser to automatically +authenticate. This only runs from the moment it opens your browser to the moment you get back the verification code. This is on `http://127.0.0.1:53682/` and it may require you to unblock it temporarily if you are running a host diff --git a/docs/content/dropbox.md b/docs/content/dropbox.md index e6c69654c..cb9af2e1c 100644 --- a/docs/content/dropbox.md +++ b/docs/content/dropbox.md @@ -56,6 +56,16 @@ d) Delete this remote y/e/d> y ``` +See the [remote setup docs](/remote_setup/) for how to set it up on a +machine with no Internet browser available. + +Note that rclone runs a webserver on your local machine to collect the +token as returned from Dropbox. This only +runs from the moment it opens your browser to the moment you get back +the verification code. This is on `http://127.0.0.1:53682/` and it +may require you to unblock it temporarily if you are running a host +firewall, or use manual mode. + You can then use it like this, List directories in top level of your dropbox diff --git a/docs/content/googlecloudstorage.md b/docs/content/googlecloudstorage.md index 2a254848f..1932696f2 100644 --- a/docs/content/googlecloudstorage.md +++ b/docs/content/googlecloudstorage.md @@ -117,9 +117,10 @@ Choose a number from below, or type in your own value \ "DURABLE_REDUCED_AVAILABILITY" storage_class> 5 Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine or Y didn't work +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y @@ -143,8 +144,12 @@ d) Delete this remote y/e/d> y ``` +See the [remote setup docs](/remote_setup/) for how to set it up on a +machine with no Internet browser available. + Note that rclone runs a webserver on your local machine to collect the -token as returned from Google if you use auto config mode. This only +token as returned from Google if using web browser to automatically +authenticate. This only runs from the moment it opens your browser to the moment you get back the verification code. This is on `http://127.0.0.1:53682/` and this it may require you to unblock it temporarily if you are running a host diff --git a/docs/content/googlephotos.md b/docs/content/googlephotos.md index bef6f3cf3..0076458ae 100644 --- a/docs/content/googlephotos.md +++ b/docs/content/googlephotos.md @@ -62,9 +62,10 @@ y) Yes n) No y/n> n Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y @@ -88,8 +89,12 @@ d) Delete this remote y/e/d> y ``` +See the [remote setup docs](/remote_setup/) for how to set it up on a +machine with no Internet browser available. + Note that rclone runs a webserver on your local machine to collect the -token as returned from Google if you use auto config mode. This only +token as returned from Google if using web browser to automatically +authenticate. This only runs from the moment it opens your browser to the moment you get back the verification code. This is on `http://127.0.0.1:53682/` and this may require you to unblock it temporarily if you are running a host diff --git a/docs/content/hidrive.md b/docs/content/hidrive.md index 0a75686ca..750e0890a 100644 --- a/docs/content/hidrive.md +++ b/docs/content/hidrive.md @@ -45,7 +45,10 @@ Leave blank normally. scope_access> Edit advanced config? y/n> n -Use auto config? +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y/n> y If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=xxxxxxxxxxxxxxxxxxxxxx Log in and authorize rclone for access diff --git a/docs/content/onedrive.md b/docs/content/onedrive.md index 43750597b..4b46fac8c 100644 --- a/docs/content/onedrive.md +++ b/docs/content/onedrive.md @@ -53,9 +53,10 @@ y) Yes n) No y/n> n Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y diff --git a/docs/content/pcloud.md b/docs/content/pcloud.md index cd15bb642..bbf06a141 100644 --- a/docs/content/pcloud.md +++ b/docs/content/pcloud.md @@ -40,9 +40,10 @@ client_id> Pcloud App Client Secret - leave blank normally. client_secret> Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y diff --git a/docs/content/premiumizeme.md b/docs/content/premiumizeme.md index 7b53b77b5..ae7f44372 100644 --- a/docs/content/premiumizeme.md +++ b/docs/content/premiumizeme.md @@ -39,9 +39,10 @@ Storage> premiumizeme ** See help for premiumizeme backend at: https://rclone.org/premiumizeme/ ** Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y diff --git a/docs/content/putio.md b/docs/content/putio.md index 79fb346a9..ae67f1eb6 100644 --- a/docs/content/putio.md +++ b/docs/content/putio.md @@ -41,9 +41,10 @@ Storage> putio ** See help for putio backend at: https://rclone.org/putio/ ** Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y @@ -76,8 +77,12 @@ q) Quit config e/n/d/r/c/s/q> q ``` +See the [remote setup docs](/remote_setup/) for how to set it up on a +machine with no Internet browser available. + Note that rclone runs a webserver on your local machine to collect the -token as returned from Google if you use auto config mode. This only +token as returned from put.io if using web browser to automatically +authenticate. This only runs from the moment it opens your browser to the moment you get back the verification code. This is on `http://127.0.0.1:53682/` and this it may require you to unblock it temporarily if you are running a host diff --git a/docs/content/remote_setup.md b/docs/content/remote_setup.md index b6d81c1b0..057e285da 100644 --- a/docs/content/remote_setup.md +++ b/docs/content/remote_setup.md @@ -15,15 +15,16 @@ two ways of doing it, described below. ## Configuring using rclone authorize ## -On the headless box run `rclone` config but answer `N` to the `Use -auto config?` question. +On the headless box run `rclone` config but answer `N` to the `Use web browser +to automatically authenticate?` question. ``` ... Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes (default) n) No y/n> n @@ -99,15 +100,16 @@ Linux and MacOS users can utilize SSH Tunnel to redirect the headless box port 5 ``` ssh -L localhost:53682:localhost:53682 username@remote_server ``` -Then on the headless box run `rclone` config and answer `Y` to the `Use -auto config?` question. +Then on the headless box run `rclone` config and answer `Y` to the `Use web +browser to automatically authenticate?` question. ``` ... Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes (default) n) No y/n> y diff --git a/docs/content/sharefile.md b/docs/content/sharefile.md index d85ec4b19..c02315872 100644 --- a/docs/content/sharefile.md +++ b/docs/content/sharefile.md @@ -57,9 +57,10 @@ y) Yes n) No y/n> n Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y diff --git a/docs/content/yandex.md b/docs/content/yandex.md index f5716ca70..0093d6235 100644 --- a/docs/content/yandex.md +++ b/docs/content/yandex.md @@ -34,9 +34,10 @@ client_id> Yandex Client Secret - leave blank normally. client_secret> Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes n) No y/n> y diff --git a/docs/content/zoho.md b/docs/content/zoho.md index c0143dcbf..e24c5be17 100644 --- a/docs/content/zoho.md +++ b/docs/content/zoho.md @@ -45,9 +45,10 @@ y) Yes n) No (default) y/n> n Remote config -Use auto config? - * Say Y if not sure - * Say N if you are working on a remote or headless machine +Use web browser to automatically authenticate rclone with remote? + * Say Y if the machine running rclone has a web browser you can use + * Say N if running rclone on a (remote) machine without web browser access +If not sure try Y. If Y failed, try N. y) Yes (default) n) No y/n> diff --git a/lib/oauthutil/oauthutil.go b/lib/oauthutil/oauthutil.go index a7326e886..cd9cb74d3 100644 --- a/lib/oauthutil/oauthutil.go +++ b/lib/oauthutil/oauthutil.go @@ -480,7 +480,7 @@ func ConfigOAuth(ctx context.Context, name string, m configmap.Mapper, ri *fs.Re if in.Result == "false" { return fs.ConfigGoto(newState("*oauth-done")) } - return fs.ConfigConfirm(newState("*oauth-islocal"), true, "config_is_local", "Use auto config?\n * Say Y if not sure\n * Say N if you are working on a remote or headless machine\n") + return fs.ConfigConfirm(newState("*oauth-islocal"), true, "config_is_local", "Use web browser to automatically authenticate rclone with remote?\n * Say Y if the machine running rclone has a web browser you can use\n * Say N if running rclone on a (remote) machine without web browser access\nIf not sure try Y. If Y failed, try N.\n") case "*oauth-islocal": if in.Result == "true" { return fs.ConfigGoto(newState("*oauth-do"))