Getting Oauth2 error when connecting to Google Drive

After meticulously following all the pertinent instructions (yes, it peeves me as well), creating my API link, giving myself access, etc I get to the Google Drive "rclone auth page", I grant it authority, it tells me "Success", and then rclone responds with

Fatal error: failed to get token: oauth2: cannot fetch token: 401 Unauthorized
Response: {
"error": "invalid_client",
"error_description": "Unauthorized"
}

I know I have everything correct as far as passwords, etc goes.

Update: Seems to work as root, not as the user

Yeah it is painful to create google client_id. Your error means only one thing - you made some small mistake in the process:

Have a look at my simplified step by step:

This probably means that your rclone.config file does not have permission to write. It is needed as tokens are constantly refreshed - you can not have read only rclone.config.

That would make sense, but I can't seem to find the rclone.config file. Is there a default location ?

Yes - but depends on OS... I can not look through my screen to see what you are using:)

Excellent point - sorry, it's late here - using POP_OS! Linux

actually here is a trick, run:

rclone config paths

note that for normal user and root you are using different file..

run above command as user you want to see where files are

jon@hulk:~$ rclone config paths
Config file: /home/jon/.config/rclone/rclone.conf
Cache dir: /home/jon/.cache/rclone
Temp dir: /tmp

I assume that only the first one is written to ?

yes we only care about rclone.conf

for root it is probably:

/root/.config/rclone/rclone.conf

Thanks for the quick assist - I'll kill the root one, as I don't really need it - was more of a test

Jon

you can also provide your specific location every time you run rclone

rclone --config /path/to/myconfig.config

Thanks - I'll note that down.

Still getting the same error, might set perms on those other two rclone.conf files just in case

ok try to run:

rclone config reconnect yourGdriveRemoteName:

and if still not good just delete from rclone.config gdrive section and create it again

1 Like

BAZINGA !! Deleted the rclone.config file, recreated it with all defaults and it works.

Only thing I didn't do is use the client_ID which I generated - I know that affects speed but I'll worry about that later.

I really appreciate the help - I usually don't screw this shit up but I'm recovering from major dental surgery and the painkillers must have caught me off-guard.

I'm using this to back up my massive ebook collection while I sort it out - feel free to hit me up if you want anything.

1 Like

You should add it - without it can be real pain with gdrive performance.

To add client_id create config again from zero - the best way - and just provide client_id/secret you already have.

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