I have created a Google service account and granted it Domain-Wide Delegation (DWD). I am trying to use the Google Drive API to list all files present in the domain, including both users' private files and shared files.
I'm making the following API request:
curl --location 'https://www.googleapis.com/drive/v3/files?includeItemsFromAllDrives=true&corpora=domain&supportsAllDrives=true' \
--header 'Authorization: Bearer ACCESS_TOKEN'
What Works:
✅ I am able to impersonate a user in the domain and successfully fetch all files for that user, which suggests that DWD is set up correctly.
Issue:
❌ The above API call does not return all files across the domain. What am I missing? Is there any additional scope, permission, or configuration required to retrieve all users' files within the domain?
Additional Details:
- The service account has Domain-Wide Delegation enabled.
- Using impersonation, I can fetch files for a specific user but not for the entire domain.
- The required scopes for Google Drive API are already granted.
Would appreciate any insights! Thanks. 🚀