Bird
0
0

If a microservice receives an expired OAuth 2.0 access token, what is the expected response it should return?

medium📝 Analysis Q5 of 15
Microservices - Authentication and Authorization
If a microservice receives an expired OAuth 2.0 access token, what is the expected response it should return?
AHTTP 401 Unauthorized with error 'invalid_token'
BHTTP 200 OK with empty response body
CHTTP 403 Forbidden with error 'access_denied'
DHTTP 500 Internal Server Error
Step-by-Step Solution
Solution:
  1. Step 1: Understand OAuth 2.0 error handling for expired tokens

    When a token is expired, the server must reject the request with a 401 status and an 'invalid_token' error.
  2. Step 2: Match the correct HTTP status and error message

    HTTP 401 Unauthorized with 'invalid_token' is the standard response for expired or invalid tokens.
  3. Final Answer:

    HTTP 401 Unauthorized with error 'invalid_token' -> Option A
  4. Quick Check:

    Expired token response = 401 Unauthorized [OK]
Quick Trick: Expired tokens get 401 Unauthorized with 'invalid_token' error [OK]
Common Mistakes:
MISTAKES
  • Returning 403 Forbidden instead of 401 Unauthorized
  • Returning 200 OK which wrongly allows access
  • Using 500 Internal Server Error which is incorrect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes