GCP Professional Cloud Architect Practice Question
Your company is developing a single-page web application that authenticates users with Google OAuth 2.0. During initial sign-in the app only needs the user's basic profile, but later it offers an "Export to Drive" feature that must write a file into the user's Google Drive. Product management wants to maximize consent-screen acceptance rates while following Google API authorization best practices. What is the most appropriate way to request OAuth scopes?
Authenticate a backend service account with domain-wide delegation and impersonate each user for all Drive operations, avoiding further scope prompts.
Request the profile, drive.file, and cloud-platform scopes together during the initial sign-in so the user is prompted only once.
Call the Drive REST API with an unrestricted API key embedded in the web page, eliminating additional consent dialogs.
Ask for the basic profile scope during login and use OAuth incremental authorization to request the drive.file scope only when the user clicks Export.
Google's recommended practice is to ask for the minimum scope necessary when it is needed. The app should therefore request only the openid or profile scope during the initial sign-in, then trigger an incremental authorization request for the more sensitive drive.file scope when the user explicitly chooses the Export action. This minimizes the number of permissions shown on the first consent screen and typically results in higher approval rates.
Requesting broad scopes such as drive.* or cloud-platform up front violates the principle of least privilege and can lower consent acceptance. Embedding an unrestricted API key on the client side removes user consent entirely and exposes the key to theft. Using a backend service account with domain-wide delegation allows access without user interaction but is intended for managed domains and still does not align with requesting scopes incrementally as the user's workflow requires.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is OAuth incremental authorization?
Open an interactive chat with Bash
Why is the principle of least privilege important in OAuth?
Open an interactive chat with Bash
What are the risks of embedding unrestricted API keys in web pages?
Open an interactive chat with Bash
GCP Professional Cloud Architect
Managing implementation
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .