4

Is there a way to programmatically access a Google Drive folder without having to manually authenticate with OAuth for every session?

I've used PyDrive and managed to access the drive, but I still have to go through the manual browser OAuth access page every time I run my Python script.

Is there any way to grant permanent access to Google Drive with Python?

Chebhou
  • 148
  • 1
  • 16
Adam Matan
  • 128,757
  • 147
  • 397
  • 562

1 Answers1

1

OAuth usually works by granting you an access_token and a refresh_token. You can store these locally on the device to be used in a later session. Once the access_token expires, you can use the refresh_token to obtain a new pair of tokens.

This should work indefinitely as long as the granting service doesn't revoke them.

Octopus
  • 8,075
  • 5
  • 46
  • 66