Get no refresh token on rclone.conf

What is the problem you are having with rclone?

There is no refresh token in my rclone.conf file. So after a time, access token expires and I get Token Expire error.

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

rclone v1.59.1

  • os/version: Microsoft Windows 10 Pro 21H2 (64 bit)
  • os/kernel: 10.0.19044.2006 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.18.5
  • go/linking: static
  • go/tags: cmount

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 sync --progress "Repository" [LOCAL_FOLDER]

The rclone config contents with secrets removed.

[Infracidades]
type = drive
client_id = XXX
client_secret = xxx
scope = drive.readonly
token = {"access_token":"TOKEN","token_type":"Bearer","expiry":"2022-09-16T09:12:35.3828141-03:00"}
team_drive = DRIVE_ID
root_folder_id =

A log from the command with the -vv flag

rclone sync --progress "Infracidades:/" a -vv
2022/09/16 12:04:19 DEBUG : rclone: Version "v1.59.1" starting with parameters ["rclone" "sync" "--progress" "Infracidades:/" "a" "-vv"]
2022/09/16 12:04:19 DEBUG : Creating backend with remote "Infracidades:/"
2022/09/16 12:04:19 DEBUG : Using config file from "G:\Downloads\Apagar\rclone\rclone.conf"
2022/09/16 12:04:19 DEBUG : fs cache: renaming cache item "Infracidades:/" to be canonical "Infracidades:"
2022/09/16 12:04:19 DEBUG : Creating backend with remote "a"
2022/09/16 12:04:19 DEBUG : fs cache: renaming cache item "a" to be canonical "//?/G:/Downloads/Apagar/rclone/a"
2022-09-16 12:04:19 DEBUG : Infracidades: Loaded invalid token from config file - ignoring
2022-09-16 12:04:19 ERROR : Google drive root '': error reading source root directory: couldn't list directory: Get "https://www.googleapis.com/drive/v3/files?alt=json&corpora=drive&driveId=0AEcWAsZ9s3LgUk9PVA&fields=files(id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CexplicitlyTrashed%2CmodifiedTime%2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%2CshortcutDetails%2CexportLinks%2CresourceKey)%2CnextPageToken%2CincompleteSearch&includeItemsFromAllDrives=true&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+('0AEcWAsZ9s3LgUk9PVA'+in+parents)&supportsAllDrives=true": token expired and there's no refresh token - manually refresh with "rclone config reconnect Infracidades:"
2022-09-16 12:04:19 ERROR : Cancelling sync due to fatal error: couldn't list directory: Get "https://www.googleapis.com/drive/v3/files?alt=json&corpora=drive&driveId=0AEcWAsZ9s3LgUk9PVA&fields=files(id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CexplicitlyTrashed%2CmodifiedTime%2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%2CshortcutDetails%2CexportLinks%2CresourceKey)%2CnextPageToken%2CincompleteSearch&includeItemsFromAllDrives=true&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+('0AEcWAsZ9s3LgUk9PVA'+in+parents)&supportsAllDrives=true": token expired and there's no refresh token - manually refresh with "rclone config reconnect Infracidades:"
2022-09-16 12:04:19 DEBUG : Local file system at //?/G:/Downloads/Apagar/rclone/a: Waiting for checks to finish
2022-09-16 12:04:19 DEBUG : Local file system at //?/G:/Downloads/Apagar/rclone/a: Waiting for transfers to finish
2022-09-16 12:04:19 ERROR : Local file system at //?/G:/Downloads/Apagar/rclone/a: not deleting files as there were IO errors
2022-09-16 12:04:19 ERROR : Local file system at //?/G:/Downloads/Apagar/rclone/a: not deleting directories as there were IO errors
2022-09-16 12:04:19 ERROR : Fatal error received - not attempting retries
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Errors: 1 (fatal error encountered)
Elapsed time: 0.1s
2022/09/16 12:04:19 INFO :
Transferred: 0 B / 0 B, -, 0 B/s, ETA -
Errors: 1 (fatal error encountered)
Elapsed time: 0.1s

hello and welcome to the forum,

need to run this command
rclone config reconnect Infracidades:

Hello! I did it.
In the end it opens the browser and everything start working fine for sometime.
But I created a script for backup daily... Everytime it expires the scripts stops running.

Anyone? As I said, I have a backup script running with rclone and connecting to google drive.
I need it to automatically refresh token when it expires.
I can see that there is no refresh token on my rclone.conf.
So it works for sometime and after the access token expires, it stops working.

You'd need to setup your client ID/secret and ensure it's on production.

Depends if you are using a personal drive, GSuite, etc.

I already did it. You can check my config files up on this thread.Client ID/Secret and its already in production.

Any ideas?
I`m still facing this problem...

Hi Ricardo,

I suspect you may have have two rclone.conf or be using two users where only one of them have write access to rclone.conf due to the way you are executing your backup script.

I therefore suggest you first try troubleshooting in a simpler setup where you try to construct tests to answer these questions:
Are you able to reproduce if using the default rclone Client ID, that is using a config without client_id and client_secret?
Are you able to reproduce if only executing rclone interactively?
Are you able to reproduce if only executing your backup script interactively?

You could test this by deleting (or renaming) your current remote and creating and connecting a new remote without client_id and client_secret.

Then use this new remote to interactively execute rclone for a period longer than the typical expiry of the token.

If this fails then we can rule out a lot of possibilities and start a more detailed analysis and debugging.

If this succeeds then add your own client_id and client_secret to the configuration and continue executing interactively for a period longer than the typical expiry of the token.

If this succeeds then start executing your backup script interactively for a period longer than the typical expiry of the token.

If this succeeds then start executing your backup script automatically (scheduled) for a period longer than the typical expiry of the token.

I know this is tedious and boring, but it may well be the easiest and fastest way if yours and ours initial guesses doesn't nail it immediately.