0

I have a user X (an account that all the team shares) that has files in Google Drive stored in 'My Unit'. Among those files, some are shared with other users, and some others aren't. I need to access both types of files with Google Drive API.

For authentication, I use a service account (JSON file of the Key). My personal user is the owner and creator of the service account in a certain project in Google Cloud. User X is added as editor in this project. Also, X is Editor and Service Account Admin of the service account, which has as well Editor role for Google APIs Service Agent. The scopes of the project are:

https://www.googleapis.com/auth/drive.appdata, https://www.googleapis.com/auth/drive

I can successfully connect to Google Drive API, but when it comes to get a list of files, the result is empty. If I try to retrieve a specific drive file id, I also get an error, that says the file is not found.

What else do I have to do for connecting to google drive?

Javier Lopez Tomas
  • 2,072
  • 3
  • 19
  • 41
  • 1
    You use some secure key? – maximus383 Oct 11 '21 at 09:25
  • I am not sure what you mean. For using the service account I downloaded the Key JSON – Javier Lopez Tomas Oct 11 '21 at 09:34
  • 1
    It's probably a team drive... and the question is rather abstract unless telling in which environment the API is being automated. – Martin Zeitler Oct 11 '21 at 09:43
  • 1
    Does this answer your question? [How to access Team Drive using service account with Google Drive .NET API v3](https://stackoverflow.com/questions/43243865/how-to-access-team-drive-using-service-account-with-google-drive-net-api-v3) (even if that may be a different environment, it's the same principle and the clients are similar). – Martin Zeitler Oct 11 '21 at 09:45
  • I think it's not a Team Drive, because in Google Admin there is no option Manage Team Drives. I am using the API in Python, by the way – Javier Lopez Tomas Oct 11 '21 at 11:05
  • Have you set up domain wide delegation for your account? [ref](https://stackoverflow.com/a/61778053/11551468) – Rafa Guillermo Oct 11 '21 at 12:22

0 Answers0