mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
@ -67,10 +67,10 @@ def auth():
|
||||
|
||||
def refresh():
|
||||
# refresh token for x amount of time (seconds)
|
||||
gauth = GoogleAuth(settings_file="settings.yaml")
|
||||
gauth = GoogleAuth(settings_file="/root/settings.yaml")
|
||||
try:
|
||||
# Try to load saved client credentials
|
||||
gauth.LoadCredentialsFile("credentials.json")
|
||||
gauth.LoadCredentialsFile("/root/credentials.json")
|
||||
except pydrive2.auth.InvalidCredentialsError:
|
||||
print(gauth.GetAuthUrl())
|
||||
user_input = input("Please copy this URL into a browser, "
|
||||
|
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user