Rclone authorize CLI, no browser, not working correctly

What is the problem you are having with rclone?

Recently, when rclone calls my default browser to re-authenticate to Google Drive, I move through the options, then "Continue" which hangs perpetually -- this happens with all firewalls and filters disabled. Using MacOS/Firefox 115. Following documentation for getting this auth URL from the CLI instead, I re-ran the configuration to adjust my preferences for Google Drive to NOT open a browser. It directs me to "Option config_token" which.... needs a browser window.

Run the command 'rclone version' and share the full output of the command.

Yes, via GIT.

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone config

The rclone config contents with secrets removed.

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

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 "drive" "[redacted]"
Then paste the result.
Enter a value.
config_token>
This value is required and it has no default.
config_token>

A log from the command with the -vv flag

Select remote.
Choose a number from below, or type in an existing value.
 1 > googledrive
 2 > rpnasw
 3 > wasabi
remote> 1

Editing existing "googledrive" remote with options:
- type: drive
- client_id: [redacted]
- client_secret: [redacted]
- scope: drive
- token: {"access_token":"[redacted]","expiry":"2023-07-05T21:02:48.422202-05:00"}
- team_drive:
- acknowledge_abuse: true

2023/07/14 11:43:08 DEBUG : googledrive: config in: state="*all", result=""
2023/07/14 11:43:08 DEBUG : googledrive: config out: out=&{State:*all-set,0,false Option:[redacted] OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:08 DEBUG : googledrive: config: reading config parameter "client_id"
Option client_id.
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ([redacted]).
client_id> [redacted]

2023/07/14 11:43:29 DEBUG : googledrive: config in: state="*all-set,0,false", result="[redacted]"
2023/07/14 11:43:29 DEBUG : googledrive: config out: out=&{State:*all,1,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:29 DEBUG : googledrive: config in: state="*all,1,false", result=""
2023/07/14 11:43:29 DEBUG : googledrive: config out: out=&{State:*all-set,1,false Option:[redacted] OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:29 DEBUG : googledrive: config: reading config parameter "client_secret"
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a string value. Press Enter for the default ([redacted]).
client_secret> [redacted]

2023/07/14 11:43:52 DEBUG : googledrive: config in: state="*all-set,1,false", result="[redacted]"
2023/07/14 11:43:52 DEBUG : googledrive: config out: out=&{State:*all,2,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:52 DEBUG : googledrive: config in: state="*all,2,false", result=""
2023/07/14 11:43:52 DEBUG : googledrive: config out: out=&{State:*all,3,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:52 DEBUG : googledrive: config in: state="*all,3,false", result=""
2023/07/14 11:43:52 DEBUG : googledrive: config out: out=&{State:*all,4,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:52 DEBUG : googledrive: config in: state="*all,4,false", result=""
2023/07/14 11:43:52 DEBUG : googledrive: config out: out=&{State:*all,5,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:52 DEBUG : googledrive: config in: state="*all,5,false", result=""
2023/07/14 11:43:52 DEBUG : googledrive: config out: out=&{State:*all-set,5,false Option:drive OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:52 DEBUG : googledrive: config: reading config parameter "scope"
Option scope.
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own string value.
Press Enter for the default (drive).
 1 / Full access all files, excluding Application Data Folder.
   \ (drive)
 2 / Read-only access to file metadata and file contents.
   \ (drive.readonly)
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ (drive.file)
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ (drive.appfolder)
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ (drive.metadata.readonly)
scope> 1

2023/07/14 11:43:55 DEBUG : googledrive: config in: state="*all-set,5,false", result="drive"
2023/07/14 11:43:55 DEBUG : googledrive: config out: out=&{State:*all,6,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:55 DEBUG : googledrive: config in: state="*all,6,false", result=""
2023/07/14 11:43:55 DEBUG : googledrive: config out: out=&{State:*all,7,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:55 DEBUG : googledrive: config in: state="*all,7,false", result=""
2023/07/14 11:43:55 DEBUG : googledrive: config out: out=&{State:*all-set,7,false Option: OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:43:55 DEBUG : googledrive: config: reading config parameter "service_account_file"
Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file>

2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all-set,7,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,8,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,8,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,9,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,9,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,10,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,10,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,11,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,11,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,12,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,12,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,13,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,13,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,14,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,14,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,15,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,15,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,16,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,16,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,17,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,17,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,18,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,18,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,19,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,19,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,20,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,20,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,21,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,21,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,22,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,22,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,23,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,23,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,24,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,24,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,25,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,25,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,26,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,26,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,27,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,27,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,28,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,28,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,29,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,29,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,30,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,30,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,31,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,31,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,32,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,32,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,33,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,33,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,34,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,34,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,35,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,35,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,36,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,36,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,37,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,37,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,38,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,38,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,39,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,39,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,40,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,40,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,41,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,41,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,42,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,42,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,43,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,43,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all,44,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config in: state="*all,44,false", result=""
2023/07/14 11:44:02 DEBUG : googledrive: config out: out=&{State:*all-advanced Option:false OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:02 DEBUG : googledrive: config: reading config parameter "config_fs_advanced"
Edit advanced config?
y) Yes
n) No (default)
y/n>

2023/07/14 11:44:17 DEBUG : googledrive: config in: state="*all-advanced", result="false"
2023/07/14 11:44:17 DEBUG : googledrive: config out: out=&{State:*postconfig Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:17 DEBUG : googledrive: config in: state="*postconfig", result=""
2023/07/14 11:44:17 DEBUG : googledrive: config in: state="", result=""
2023/07/14 11:44:17 DEBUG : googledrive: config out: out=&{State:*oauth,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:17 DEBUG : googledrive: config out: out=&{State:*oauth,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:17 DEBUG : googledrive: config in: state="*oauth,teamdrive,,", result=""
2023/07/14 11:44:17 DEBUG : googledrive: config out: out=&{State:*oauth-confirm,teamdrive,, Option:true OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:17 DEBUG : googledrive: config: reading config parameter "config_refresh_token"
Already have a token - refresh?
y) Yes (default)
n) No
y/n>

2023/07/14 11:44:31 DEBUG : googledrive: config in: state="*oauth-confirm,teamdrive,,", result="true"
2023/07/14 11:44:31 DEBUG : googledrive: config out: out=&{State:*oauth-islocal,teamdrive,, Option:true OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:31 DEBUG : googledrive: config: reading config parameter "config_is_local"
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

2023/07/14 11:44:34 DEBUG : googledrive: config in: state="*oauth-islocal,teamdrive,,", result="false"
2023/07/14 11:44:34 DEBUG : googledrive: config out: out=&{State:*oauth-remote,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:34 DEBUG : googledrive: config in: state="*oauth-remote,teamdrive,,", result=""
2023/07/14 11:44:34 DEBUG : sending scope = "drive"
2023/07/14 11:44:34 DEBUG : sending acknowledge_abuse = "true"
2023/07/14 11:44:34 DEBUG : sending client_id = "[redacted]"
2023/07/14 11:44:34 DEBUG : sending client_secret = "[redacted]"
2023/07/14 11:44:34 DEBUG : googledrive: config out: out=&{State:*oauth-authorize,teamdrive,, Option: OAuth:<nil> Error: Result:}, err=<nil>
2023/07/14 11:44:34 DEBUG : googledrive: config: reading config parameter "config_token"
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 "drive" "[redacted]"
Then paste the result.
Enter a value.
config_token>

It would be great to have a -vv option that automatically masks references to id's, tokens and secrets. This was a LOT of manual editing.

note: to create a token with gdrive, need to use a web browser.

what version for rclone, what is the full output of rclone version?
latest stable is v1.63.0

as a test, i created a new gdrive remote, ran rclone config on a headless machine and then ran rclone authorize "drive" on a machine with a browser, did the copy/paste of the token.
that all worked fine.

that is a work in progress
Rclone config redacted - testing needed

It does not hang but waits for you to finish authentication in the browser e.g.:

2023/07/14 18:06:38 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=R5tx2_quAzpnd9lhwvtK6A
2023/07/14 18:06:38 NOTICE: Log in and authorize rclone for access
2023/07/14 18:06:38 NOTICE: Waiting for code...

Go to your browser and you should have there authentication window opened.

Maybe this message If your browser doesn't open automatically is confusing as on macOS/Firefox indeed browser is not opened automatically (not sure about other systems) but only tab in the browser is opened in the background.

Even if this is not the case (people have sometimes crazy settings) it tells you link you should open in browser manually:

http://127.0.0.1:53682/auth?state=R5tx2_quAzpnd9lhwvtK6A

in my example. This link will be different for you

Thank you for taking the time to respond.

I should have added that the "Continue" part of the confirmation/authentication with Google stalls with the opaqued window and moving blue line. It doesn't stop. I've let it sit there for a long time. I've disabled firewalls, filters, and I get the same result. This is fairly recent, within the last 2 or 3 weeks.

would you mind to share screenshot? I am not sure if I understand:)

Here's a screensot -- see that it's opaque and the blue line is spinning... this is what has been happening, it just hangs there.

OK. Ta.

It looks for me like you have some aggressive add blocker and/or Firefox strict tracking protection on. Probably it waits for you to accept some google's cookies - but this is blocked. I use the same setup and see it often. It has nothing to do with rclone - simply your browser prevents you from certain websites' operations.

To fix it you can just ignore Firefox with your fav settings and for this one off task start some other browser - Safari is fine and copy/paste link you are shown in terminal:

If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=R5tx2_quAzpnd9lhwvtK6A

Thank you for this, I was able to get it working -- it took a couple of times, but I got it processing now. I wonder if there might be a way to have rclone call a specific browser, to bypass a system preference. For example, a text-based client. But it would need to have all those cookies available. If I can figure out how to get Firefox to permit this, that is probably more useful -- others will likely run into it.

Tin foil hat browser settings mean you have to learn how to live with it. Usually tin foil hat people understand what they are doing.

Most people do not have any problems so there is no really reason for rclone to accommodate 1% of tinkers.

Myself I do have multiple add blockers etc. but I know that it comes at the cost of issues from time to time I have to deal with.

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