GDrive refresh token expires every hour

#1

I’ve tested rclone copy to GDrive and have been blocked on exactly the moment the refresh token is set to expire.

This is the debug message I get right as the token expires: Google drive root 'path': Failed to get StartPageToken: Get https://www.googleapis.com/drive/v3/changes/startPageToken?alt=json&supportsTeamDrives=false: oauth2: token expired and refresh token is not set

I made sure the timezone is set correctly in case that makes a difference.

#2

Token expired I think is when you have had your credentials removed from the GD if I’m not mistaken.

If you are using your own API keys, you’d see your project/company name as 3rd party access or you’d see “rclone” if you are using the standard rclone API key.

Do you see either of those in your 3rd party apps with access?

#3

Thanks for the reply. I see both of them there with access to drive. I’m using my own keys.

#4

What does your rclone.conf look like?

[GD]
type = drive
client_id = yourkeyhere.apps.googleusercontent.com
client_secret = secretkey
token = {"access_token":"thelongaccesstoken","token_type":"Bearer","refresh_token":"1thefrestoken","expiry":"2018-08-15T13:14:04.719148767-04:00"}

You can see my file was updated at 12:14 and will update every hour:

felix@gemini:~$ ls -al .rclone.conf
-rw------- 1 felix felix 1004 Aug 15 12:14 .rclone.conf
#5

Mine looks exactly the same, the issue only seems to occur when I’m doing multiple copies over an hour in time. So I’ll start copying starting at 12:00 and maybe do 20 of them before it hits 1:00 and the token expires with rclone giving me the error message I cited above.

If I don’t do any copying, the token doesn’t seem to cause any issues as I’ve had it sit for days and read from gdrive with no errors.

#6

That’s very odd.

I run a mount 24x7 and run a few copies at night and never had an issue with expiration.

#7

When you say multiple copies, are you running multiple copies of rclone?

And are the transfers themselves longer than one hour?

#8

Sorry for reliving an old topic. I’m seeing this or a similar problem.

Long time user of rclone without client-id, never had an issue. Today, I decided to enable it since it is recommended in several places. After creating the id and authorizing the client I started seeing the problem.

I’m doing a backup to gdrive that takes longer than an hour (files being uploaded don’t take longer than an hour). It runs normally until, at some point, the 401 error starts to pop up. If I go through rclone config or authorize it works again for another hour. Previously I never had to reauthorize.

Thanks for any ideas on how to debug this.

#9

Please make a new topic and include version, config and log files.

closed #10