Rclone google drive token not refreshing

What is the problem you are having with rclone?

After a while, the token expires, and I'm forced to use rclone reconnect to get a new token and be able to use RCLone again.

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

rclone v1.69.1

  • os/version: arch (64 bit)
  • os/kernel: 6.14.7-arch2-1 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.24.0
  • go/linking: dynamic
  • 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)

As a system unit:

[Unit]
Description=rclone for gdrive_mount
AssertPathIsDirectory=/home/adam/Documents/GDRIVE-ADAM
After=networking.service

[Service]
Type=simple
ExecStart=rclone mount --config=/home/adam/.config/rclone/rclone.conf "GDrive Adam:" /home/adam/Documents/GDRIVE-ADAM --allow-other --cache-db-purge --fast-list --poll-interval 10m -vv
ExecStop=/bin/fusermount -u /home/adam/Documents/GDRIVE-ADAM
Restart=always
RestartSec=10

[Install]
WantedBy=default.target

So:

rclone mount --config=/home/adam/.config/rclone/rclone.conf "GDrive Adam:" /home/adam/Documents/GDRIVE-ADAM --allow-other --cache-db-purge --fast-list --poll-interval 10m -vv

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[GDrive Adam]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
token = XXX
team_drive =

A log from the command that you were trying to run with the -vv flag

When I run it while the token expired, I get this:

2025/05/08 13:20:47 DEBUG : rclone: Version "v1.69.1" starting with parameters ["rclone" "mount" "--config=/home/adam/.config/rclone/rclone.conf" "GDrive Adam:" "/home/adam/Documents/GDRIVE-ADAM" "--allow-other" "--cache-db-purge" "--fast-list" "--poll-interval" "10m" "-vv"]
2025/05/08 13:20:47 NOTICE: --fast-list does nothing on a mount
2025/05/08 13:20:47 DEBUG : Creating backend with remote "GDrive Adam:"
2025/05/08 13:20:47 DEBUG : Using config file from "/home/adam/.config/rclone/rclone.conf"
2025/05/08 13:20:47 DEBUG : GDrive Adam: Loaded invalid token from config file - ignoring
2025/05/08 13:20:47 DEBUG : GDrive Adam: got fatal oauth error: oauth2: "invalid_grant" "Token has been expired or revoked."
2025/05/08 13:20:47 CRITICAL: Failed to create file system for "GDrive Adam:": couldn't find root directory ID: Get "https://www.googleapis.com/drive/v3/files/root?alt=json&fields=id&prettyPrint=false&supportsAllDrives=true": couldn't fetch token: invalid_grant: maybe token expired? - try refreshing with "rclone config reconnect GDrive Adam:"

I never saw in the logs anything regarding a fail of token refresh, as it never tried while I ran the command to refresh the token, just straight up says "failed to create file system".
I searched on similar topics, but none mentioned the logs I get, even though they all shared the similarity of having to use reconnect.

welcome to the forum,

that does nothing, can remove it. that flag was used by the deprecated cache remote.


minutes, hours, days, 7 days, months or what?


based on forum posts, normally that should be Type=notify

1 Like

Here is the output of

2 adam@TOUR-ADAM ~ % sudo rclone config reconnect "GDrive Adam": -vv
2025/05/25 16:43:15 DEBUG : rclone: Version "v1.69.1" starting with parameters ["rclone" "config" "reconnect" "GDrive Adam:" "-vv"]
2025/05/25 16:43:15 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2025/05/25 16:43:15 DEBUG : GDrive Adam: config in: state="", result=""
2025/05/25 16:43:15 DEBUG : GDrive Adam: config out: out=&{State:*oauth,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2025/05/25 16:43:15 DEBUG : GDrive Adam: config in: state="*oauth,teamdrive,,", result=""
2025/05/25 16:43:15 DEBUG : GDrive Adam: config out: out=&{State:*oauth-confirm,teamdrive,, Option:true OAuth:<nil> Error: Result:}, err=<nil>
2025/05/25 16:43:15 DEBUG : GDrive Adam: config: reading config parameter "config_refresh_token"
Already have a token - refresh?
y) Yes (default)
n) No
y/n> 

2025/05/25 16:43:20 DEBUG : GDrive Adam: config in: state="*oauth-confirm,teamdrive,,", result="true"
2025/05/25 16:43:20 DEBUG : GDrive Adam: config out: out=&{State:*oauth-islocal,teamdrive,, Option:true OAuth:<nil> Error: Result:}, err=<nil>
2025/05/25 16:43:20 DEBUG : GDrive Adam: 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> 

2025/05/25 16:43:28 DEBUG : GDrive Adam: config in: state="*oauth-islocal,teamdrive,,", result="true"
2025/05/25 16:43:28 DEBUG : GDrive Adam: config out: out=&{State:*oauth-do,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2025/05/25 16:43:28 DEBUG : GDrive Adam: config in: state="*oauth-do,teamdrive,,", result=""
2025/05/25 16:43:28 NOTICE: Make sure your Redirect URL is set to "http://127.0.0.1:53682/" in your custom config.
2025/05/25 16:43:28 DEBUG : Starting auth server on 127.0.0.1:53682
2025/05/25 16:43:28 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=ceKExesXrdquDtXl9vlAdQ
2025/05/25 16:43:28 NOTICE: Log in and authorize rclone for access
2025/05/25 16:43:28 NOTICE: Waiting for code...
2025/05/25 16:43:32 DEBUG : Redirecting browser to: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=<REDACTED>&redirect_uri=http%3A%2F%2F127.0.0.1%3A53682%2F&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=<REDACTED>
2025/05/25 16:43:42 DEBUG : Received GET request on auth server to "/"
2025/05/25 16:43:42 NOTICE: Got code
2025/05/25 16:43:42 DEBUG : Closing auth server
2025/05/25 16:43:42 DEBUG : Closed auth server with error: accept tcp 127.0.0.1:53682: use of closed network connection
2025/05/25 16:43:42 DEBUG : Saving config "token" in section "GDrive Adam" of the config file
2025/05/25 16:43:42 DEBUG : GDrive Adam: Saved new token in config file
2025/05/25 16:43:42 DEBUG : GDrive Adam: config out: out=&{State:*oauth-done,teamdrive,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2025/05/25 16:43:42 DEBUG : GDrive Adam: config in: state="*oauth-done,teamdrive,,", result=""
2025/05/25 16:43:42 DEBUG : GDrive Adam: config out: out=&{State:teamdrive Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2025/05/25 16:43:42 DEBUG : GDrive Adam: config in: state="teamdrive", result=""
2025/05/25 16:43:42 DEBUG : GDrive Adam: config out: out=&{State:teamdrive_ok Option:false OAuth:<nil> Error: Result:}, err=<nil>
2025/05/25 16:43:42 DEBUG : GDrive Adam: config: reading config parameter "config_change_team_drive"
Configure this as a Shared Drive (Team Drive)?

y) Yes
n) No (default)
y/n> n

2025/05/25 16:43:49 DEBUG : GDrive Adam: config in: state="teamdrive_ok", result="false"
2025/05/25 16:43:49 DEBUG : Saving config "team_drive" in section "GDrive Adam" of the config file
2025/05/25 16:43:49 DEBUG : GDrive Adam: config out: out=<nil>, err=<nil>
2025/05/25 16:43:49 DEBUG : rclone: Version "v1.69.1" finishing with parameters ["rclone" "config" "reconnect" "GDrive Adam:" "-vv"]

I have no idea on the time it takes to expire, as I open my computer randomly (sometimes after weeks of not using it), and never took note of the last time I reconnected.

Changed this alongside the removal of --cache-db-purge and --fast-list, thanks.

i assume the issue is on your end, else the forum would be flooded with new topics.
so, create a new remote from scratch, follow the rclone docs.

and/or create a systemd timer to runs once a day.
rclone lsd "GDrive Adam:"

Im having the same issue, the token expires each eight days or so.

I already have a script that runs daily and syncs a folder to google drive. Not using mount, because it is meant to run daily. Im gonna try putting the rclone lsd in it before the sync and see if it solves.

Is there a way to set the token to expire monthly or so?

rclone v1.69.2

  • os/version: ubuntu 24.04 (64 bit)
  • os/kernel: 6.8.0-60-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.24.2
  • go/linking: static
  • go/tags: none

[gdrive]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
token = XXX
team_drive =
impersonate = XXX

welcome to the forum,

imo, the issue is on your end, else the forum would be flooded with new topics.
so, create a new remote from scratch, follow the rclone docs.

1 Like

It seems like gdrive's tokens expire in 7 days by default.

that is still my suggestion.


tokens expire, but rclone should notice that and ask for a new token, as shown below.

rclone lsd gdrive01: -vv
DEBUG : rclone: Version "v1.69.3" starting with parameters ["rclone" "lsd" "gdrive01:" "-vv"]
DEBUG : gdrive01: Loaded invalid token from config file - ignoring
DEBUG : Saving config "token" in section "gdrive01" of the config file
DEBUG : gdrive01: Saved new token in config file
           0 2025-05-26 09:05:20        -1 zork

afiak, the seven days issue is something different and much discussed in the forum.
https://forum.rclone.org/search?q=google%20token%207%20days