Option to not open browser when using rclone config (reconnect)

I need an option to tell rclone not to open the browser when using rclone config reconnect.

There is an option for rclone authorize (--auth-no-open-browser) but this option doesn't exist for rclone config reconnect. No options are offered in the help pages or documentation for rclone config reconnect.

The situation is that I have two browsers on my machine. My default browser (Chrome) is logged into my work account. I have a personal OneDrive linked to an account logged in on Firefox. When rclone opens my default browser with the auth link, Microsoft very quickly replies with a token for my work account. I would rather just get the link and paste it into whatever browser I want. Or alternatively, open it in a private browsing session so I can login manually.

Simply do not start the browser automatically:

$ rclone config reconnect remote:

Already have a token - refresh?
y) Yes (default)
n) No
y/n> y

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

Answer No for the last question and copy/paste authentication link to browser of your choice.

I think this is too easy to justify some extra development to solve minor extra step user can perform.

Of course such improvements are welcomed even if minor - if you think it is critical for you then submit PR.

Doesn't that just tell you to run rclone authorize? Is there an option to tell it to just give you the URL so you can copy and paste it?

This is especially problematic if you do this on a mobile device with Termux.

Option is to answer No for "Use web browser to automatically...".

I bet Android supports copy/paste.

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

Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
        rclone authorize "onedrive" "eyJkcml2ZV9pZCI6IjYyNTdlMGMxMTQ0YjRhNjkiLCJkcml2ZV90eXBlIjoicGVyc29uYWwifQ"
Then paste the result.
Enter a value.
config_token>

I can't copy and paste the huge token from another machine onto Android...

I just want it to give me the URL without opening it in a browser...

maybe i do not understand understand your issue, so this may be off-topic
if termux default opens the wrong browser, just copy and paste the url into the other browser.
or as this is a one-time issue, just log out of default browser, run rclone, and re-login into the default browser.
much easier to copy/paste using the browser url bar, then termux terminal.

in the past, i have done that with termux with gdrive and it worked just fine.

so i tried it just now and again, worked great..

  1. from my machine, ssh into termux. ssh is optional, but makes copy/paste much easier.
    but not a problem to copy/paste with termux direct in the terminal.
  2. run rclone config reconnect gdrive:
  3. on the phone, termux launches google chrome
    3a. if you want to use another browser, just copy the url from chrome into firefox.
  4. on the phone, in chrome/firefox, i login in
  5. rclone gets token
~ $ rclone config reconnect gdrive:
Already have a token - refresh?
y) Yes (default)
n) No
y/n> y

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

2023/10/31 18:46:05 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=-s_I8QAJfeikkMXqDYaHOw
2023/10/31 18:46:05 NOTICE: Log in and authorize rclone for access
2023/10/31 18:46:05 NOTICE: Waiting for code...
2023/10/31 18:46:20 NOTICE: Got code
Configure this as a Shared Drive (Team Drive)?

y) Yes
n) No (default)
y/n>

~ $ rclone lsd gdrive:
          -1 2023-02-22 21:19:13        -1 zork

The problem is that as soon as rclone opens the browser, the browser instantly redirects to Microsoft which instantly provides the token since the browser is logged in.

See attached gif.
rclone

It's logged into the wrong account, so it gets a token for a different account. I have no opportunity to login to the correct account

maybe you are making this more complex than it needs to be.

just copy the url from termux and paste it into any browser you want.
not sure how that can be a problem?

or

rclone config reconnect is usallly a one-time operation.

do the following simple steps.

  1. on browser, log out of micro$oft.
  2. run rclone
  3. on browser, log back into micro$soft.

I don't have time to copy the URL before rclone opens the browser. The original issue is that I don't want rclone to open the browser. I could then copy the URL and open a private browser session to login.

Logging out and back in is a very unfriendly way to work around what rclone thinks is being helpful...

Look at the gif in my last post and you'll see why copying the URL is a problem...

rclone config reconnect is usallly a one-time operation.

Not when your organization makes you change your password every 60 days because reasons...

I might just have to start looking at the code to see if I can implement this and do a PR. I'm not very familiar with Go yet, but maybe this is the kick in the pants I need to study it...

1 Like

just a thought. What your company policy about changing passwords has to do with your personal OneDrive account?

You just authenticate it once and can use forever. If you can't change default browser at all you can generate OneDrive config on another machine and use on different one - again it would be one off process.

But if you can make all process more smooth and improve rclone then it is even better. This is great attitude.:+1::+1::+1:

add a flag

--browser='/usr/bin/firefox -private-window http://127.0.0.1:53682/auth?state=-s_I8QAJfeikkMXqDYaHOw'

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.