Using access_tokens with Google Drive


I am planning on using rclone as an automated backup solution to S3. It seems to work nicely, but my issue is with the OAuth generation token: From what I understand, using the ClientID and ClientSecret you have to direct the user to an “approbation” page and it gives you an access_token, which needs to get refreshed every hour or so.

I want to automate the creation process in a CloudFormation stack; What would be the “good” way to do this? Do I have to manually create a file which will be uploaded to the machine that will do the sync? Or is it possible to use a service account that won’t need any user interaction? If I create a config file on a separate machine and transfer it, will it be usable for a long time?

Thank you!

S3 doesn’t use oauth - it uses some secret values. So I will assume from now on that you mean something that does use oauth like Google Drive or Amazon Drive.

That is correct.

That is the way I would do it.

The config file will have a refresh token in it which seem to last indefinitely. The refresh token is used to get the access tokens which last for 1 hour or so.

The oauth login flow wasn’t designed to be automated and it can include things like 2FA so if you try to automate it that way you are on to a loser I think.

Hello Nick! Thank you for your answer!

S3 doesn’t use oauth

Yeah sorry, I meant GDrive to S3 backup solution.

This is what I thought; That said, I think it’s a good-enough solution while waiting for service accounts support for Google Drive :wink:

Should work for the moment yes! I’d love some help with that issue if you or someone you know could help?

Yes, I might try a PR during the holidays :wink: (Never used go, though…)