OAuth 2.0 is a protocol that allows a user to grant limited access to their resources on one site to another site, without sharing their credentials.
Click to reveal answer
beginner
Name the four main roles in the OAuth 2.0 flow.
The four main roles are: Resource Owner (user), Client (app requesting access), Authorization Server (issues tokens), and Resource Server (hosts protected resources).
Click to reveal answer
beginner
What is an access token in OAuth 2.0?
An access token is a credential issued by the authorization server that the client uses to access protected resources on behalf of the user.
Click to reveal answer
intermediate
Explain the Authorization Code Grant flow in OAuth 2.0.
The client redirects the user to the authorization server to get an authorization code. Then the client exchanges this code for an access token to access resources securely.
Click to reveal answer
intermediate
Why is the Authorization Code Grant flow considered more secure than the Implicit Grant?
Because the access token is never exposed to the user agent or browser directly; it is exchanged securely on the backend, reducing risk of token leakage.
Click to reveal answer
Which OAuth 2.0 role is responsible for issuing access tokens?
AResource Server
BClient
CResource Owner
DAuthorization Server
✗ Incorrect
The Authorization Server issues access tokens after authenticating the user and client.
In OAuth 2.0, what does the client receive after the user authorizes access in the Authorization Code Grant?
AAccess token directly
BAuthorization code
CRefresh token only
DUser credentials
✗ Incorrect
The client first receives an authorization code, which it exchanges for an access token.
Which OAuth 2.0 flow is best suited for single-page applications without a backend?
AImplicit Grant
BClient Credentials Grant
CAuthorization Code Grant
DResource Owner Password Credentials Grant
✗ Incorrect
Implicit Grant is designed for apps that cannot securely store client secrets, like single-page apps.
What is the main security risk if the access token is exposed in the browser?
AClient secret exposure
BUser password theft
CToken replay or misuse
DAuthorization code leakage
✗ Incorrect
If an access token is exposed, attackers can reuse it to access protected resources.
Which OAuth 2.0 role hosts the protected resources the client wants to access?
AResource Server
BResource Owner
CClient
DAuthorization Server
✗ Incorrect
The Resource Server holds the protected data and validates access tokens.
Describe the step-by-step flow of the OAuth 2.0 Authorization Code Grant.
Think about how the client gets permission and then accesses resources.
You got /4 concepts.
Explain why OAuth 2.0 improves security compared to sharing user credentials directly.
Focus on how OAuth limits what the client can do and protects user passwords.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the OAuth 2.0 Authorization Code flow?
easy
A. To replace user authentication with biometric data
B. To store user passwords safely on the server
C. To allow apps to access user data securely without sharing passwords
A. An access token 'token456' valid for 3600 seconds
B. An error because client_secret is missing
C. A refresh token instead of access token
D. No token, only a confirmation message
Solution
Step 1: Analyze the token request
The app sends a POST request with grant_type authorization_code and includes the code and client credentials.
Step 2: Interpret the response
The response contains an access_token 'token456', token_type 'Bearer', and expires_in 3600 seconds, meaning the token is valid for one hour.
Final Answer:
An access token 'token456' valid for 3600 seconds -> Option A
Quick Check:
Token response includes access_token and expiry [OK]
Hint: Token response includes access_token and expiry time [OK]
Common Mistakes:
Expecting refresh token instead of access token
Missing client_secret causes error
Confusing confirmation message with token response
4. A developer implements OAuth 2.0 Authorization Code flow but the app never receives an access token after exchanging the code. What is the most likely cause?
medium
A. The app forgot to include the client_id in the authorization request
B. The redirect URI used in the token request does not match the one registered
C. The user did not enter their password correctly
D. The access token expired before the request
Solution
Step 1: Identify common OAuth token exchange errors
One frequent error is a mismatch in redirect URI between authorization and token requests.
Step 2: Understand impact of redirect URI mismatch
If the redirect URI differs, the authorization server rejects the token request, so no access token is returned.
Final Answer:
The redirect URI used in the token request does not match the one registered -> Option B
Quick Check:
Redirect URI mismatch blocks token issuance [OK]
Hint: Check redirect URI matches exactly in all requests [OK]
Common Mistakes:
Blaming user password errors for token issues
Ignoring client_id in authorization request
Assuming token expires before it is issued
5. You are designing a system that uses OAuth 2.0 Authorization Code flow for a mobile app and a web app. Which approach best secures the access tokens and refresh tokens?
hard
A. Use Authorization Code flow with PKCE for the mobile app and standard Authorization Code flow for the web app
B. Use Implicit flow for both apps to simplify token handling
C. Store access tokens in local storage for both apps to allow easy access
D. Send access tokens directly in URL query parameters for both apps
Solution
Step 1: Understand security needs for mobile and web apps
Mobile apps cannot keep client secrets safe, so PKCE (Proof Key for Code Exchange) enhances security for Authorization Code flow.
Step 2: Choose best practices for token storage and flow
Web apps can use standard Authorization Code flow with client secret. Implicit flow is deprecated due to security risks. Storing tokens in local storage or URLs exposes them to attacks.
Final Answer:
Use Authorization Code flow with PKCE for the mobile app and standard Authorization Code flow for the web app -> Option A
Quick Check:
PKCE secures mobile OAuth; standard flow suits web apps [OK]
Hint: Use PKCE for mobile apps, standard flow for web apps [OK]
Common Mistakes:
Using Implicit flow despite security risks
Storing tokens insecurely in local storage
Passing tokens in URL parameters
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.