On providing token in rclone.conf rclone does not refreshes token after expiry for google drive

I have configure rclone.conf

type = drive
scope = drive.readonly
client_id = "bla.jt.apps.googleusercontent.com"
client_secret = "blaWuT"
token_uri = https://oauth2.googleapis.com/token
token = {"access_token":"ya29.blabla", "refresh_token": "1//0gqblaOVtLU"}

idealy rclone should refresh the token using refresh_token on expiry. This does not seem to case for me for google drive.
it has been mentioned that rclone refreshs token automatically.
is there something wrong the way, i am configuring rclone.

The regular gdrive apis is working fine for days and the token is getting refreshed automatically on expiry. on the calll

Please fill out the template so we have all the required details like version, debug logs etc.

Without the logs, I can only guess that you are facing the same issue described here:

The issue is bit different, refresh token is still valid but access token is invalid.
we should be able to generate newer access token from refresh token.

I am refer to this link.
developers.google. com/identity/protocols/oauth2/web-server#refresh
(don't have access to post link, please add https)

logs for reference

2021/02/09 14:16:46 DEBUG : rclone: Version "v1.54.0" starting with parameters ["./rclone" "ls" "hitano:" "-vv"]
2021/02/09 14:16:46 DEBUG : Using config file from "/Users/ats/Downloads/rclone-v1.54.0-osx-amd64/rclone.conf"
2021/02/09 14:16:46 DEBUG : Creating backend with remote "hitano:"
2021/02/09 14:16:47 Failed to create file system for "hitano:": couldn't find root directory ID: googleapi: Error 401: Invalid Credentials, authError

so in rclone.conf, if i manually update the access_token , it works , but after 60 mins when access token is expired. it start throw above error.

type = drive
scope = drive.readonly
client_id = "bla.jt.apps.googleusercontent.com"
client_secret = "blaWuT"
token_uri = https://oauth2.googleapis.com/token
token = {"access_token":"ya29.blabla", "refresh_token": "1//0gqblaOVtLU"}

if my refresh_token is valid , shouldn't the access token be updated automatically on expiry.
Is there something wrong , how we are configuring rclone?

Yes the refresh token should work.

You are using your own client_id so I would suspect that configuration as being the most likely suspect.

Removed, client_id, still same error

Did you rclone config reconnect yourconfig: after you commented out client_id and client_secret?

Is rclone config reconnect yourconfig: needed , if yes, is there any other way ,other than using interactive cli,
i have python script where i want to do this. i am using this lib

You need to do it once after you change client_id and client_secret

Are there other way other using interactive cli to reconnect.

You can use a service account configured from a file, otherwise it needs to be interactive.

Are you startingrclone mount via the rc? Or doing other long running rclone commands via the rc? If so, then please try this beta

v1.55.0-beta.5216.e556df071.fix-backend-cancel-context on branch fix-backend-cancel-context

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