A web app running on a Compute Engine VM needs to write files to each user's Google Drive. How should you authenticate to the Drive API so the app can write to a specific user's Drive?
Choose an answer
Tap an option to check your answer.
Correct answer: Use an OAuth client ID with the Drive file OAuth scope to obtain an access token for each user..
Why this is the answer
To write to a specific user's Google Drive, the application needs explicit permission from that user. An OAuth client ID, combined with the appropriate Drive API scope (e.g., https://www.googleapis.com/auth/drive.file), allows the application to request consent from each user. Upon consent, the application receives an access token enabling it to perform actions on that user's behalf. Using delegated domain-wide authority is for G Suite (now Google Workspace) administrators to grant applications access to user data across an entire domain without individual user consent, which is not suitable for individual user Drive access in a web app. Service accounts are for server-to-server interactions and do not represent individual users, so they cannot directly access a user's personal Drive.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed