PyDrive2 icon indicating copy to clipboard operation
PyDrive2 copied to clipboard

Delete/Trash files when authenticating with a Service Account

Open lpares12 opened this issue 1 year ago • 2 comments

Hi!

So I need to use service account authentication since I'm in a headless setup with no GUI access in the machine. So I have created a service account, shared the drive folder with that account and given it Editor permissions.

The problem is that I can't seem to remove files like this. I googled a bit and turns out Editors can't remove files from Drive. So I'm wondering if there's any approach with PyDrive2 to have a headless setup and to be able to remove files.

Any alternatives will be appreciated!

Also trashing the files would be okay, but can't do that either.

lpares12 avatar Jul 05 '24 08:07 lpares12

I think yes, you should be able to list files and delete them with the api. Have you tried it? In a similar way to the regular drive.

shcheklein avatar Jul 05 '24 15:07 shcheklein

Service accounts don't seem to have permissions for deleting or trash/untrash. I was wondering if there's any other way I can headlessly authenticate with PyDrive2. But that would force me to log in with the admin account anyways, which is not ideal. Seems like a Drive limitation.

lpares12 avatar Jul 05 '24 15:07 lpares12