GDrive, OAuth2, Headless reauthorization

What is the problem you are having with rclone?

GDrive token expired, no longer able to access, and manual token refresh flow doesn't work. When I copy the link rclone generates and navigate there in the browser, I get a 400 Bad Request saying that the app doesn't comply with Google's security policies.

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

rclone v1.57.0
- os/version: amazon 2 (64 bit)
- os/kernel: 4.14.158-129.185.amzn2.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.2
- go/linking: static
- go/tags: none

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.

type = drive
client_id =
client_secret = xxxxxxxx
scope = drive.readonly
token = {"access_token":"xxxxxxxx","token_type":"Bearer","refresh_token":"xxxxxxxx","expiry":"2022-03-05T17:02:28.595777873Z"}
team_drive = xxxxxxx
root_folder_id =

A log from the command with the -vv flag

2022/03/17 14:08:20 DEBUG : gdrive: config in: state="*oauth-islocal,teamdrive,,", result="false"
2022/03/17 14:08:20 DEBUG : gdrive: config out: out=&{State:*oauth-remote,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/03/17 14:08:20 DEBUG : gdrive: config in: state="*oauth-remote,teamdrive,,", result=""
2022/03/17 14:08:20 DEBUG : gdrive: config out: out=&{State:*oauth-do,teamdrive,, Option: OAuth:<nil> Error: Result:}, err=<nil>
2022/03/17 14:08:20 DEBUG : gdrive: config: reading config parameter "config_verification_code"

Few posts on this:

This app is blocked when login Google Account - Help and Support - rclone forum

It's surprisingly hard to find the posts that contain the answers, but a lot of posts with questions :slight_smile: But thanks, I think the beta may be the answer.

You have a valid point, many forget to mark the post that answered their question - did you? :wink:

I will when I determine it works :slight_smile:

Hmm... attempting to install the beta as instructed results in

curl | sudo bash -s beta

curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

I can download the non-beta fine. Seems to be just the beta subdomain?

I can cannot help with the script, but I am able to download the linux amd64 beta executable directly from here:

Oops, but the downloaded zip is invalid.

@ncw I guess this is for you (I tried

1 Like

I was able to get the beta and connect everything - halleluiah! Thanks everyone.

For the record, the solution was to install the beta 1.58 (via curl | sudo bash -s beta) which uses the new authentication flow, and then use the beta docs at

1 Like

I'll just add a coda that rclone 1.58 with the fix in has now been released. It is almost identical to the beta.

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