Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-10-13 09:19:35 +02:00
parent 12e184df96
commit 228d924e2c
2 changed files with 8 additions and 3 deletions

View File

@ -53,9 +53,14 @@ class GdriveSync(plugins.Plugin):
try:
gauth = GoogleAuth(settings_file="/root/settings.yaml")
gauth.LoadCredentialsFile("/root/credentials.json")
if gauth.credentials is None:
# Authenticate if they're not there
gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
# Refresh them if expired
gauth.Refresh()
gauth.Authorize()
# Create GoogleDrive instance
self.drive = GoogleDrive(gauth)