
Answer-first summary for fast verification
Answer: 1. When a user arrives at your application, route them to a Google Cloud consent screen with a list of requested permissions that prompts the user to sign in with SSO to their Google Account. 2. After the user signs in and provides consent, your application receives an authorization code from a Google server. 3. The application requests a Google Server to exchange the authorization code with an access token. 4. The Google server responds with the access token that is used by the application to call the Google Cloud API.
The correct workflow uses OAuth 2.0 authorization code flow, which is the recommended method for authenticating users to Google Cloud APIs. Option D follows this flow: redirecting users to Google's consent screen, obtaining an authorization code, exchanging it for an access token server-side, and using the token for API calls. Other options are incorrect: A and B involve handling user credentials directly (unsafe and unsupported by Google), while C mishandles the authorization code by storing it in cookies and not exchanging it for a token.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are building a Java web server that must interact with Google Cloud services through the Google Cloud API while acting on behalf of users. The application should allow users to authenticate to the Google Cloud API using their Google Cloud identities. What authentication workflow should you implement in your web application?
A
B
C
D