Bird
0
0

Given this error response:

medium📝 Predict Output Q4 of 15
Rest API - Error Handling
Given this error response:
{"error": {"code": "AUTH_FAILED", "message": "Invalid token"}}

What should a client do to handle this error consistently?
ARetry the request immediately without changes
BIgnore the error and continue
CPrompt the user to login again
DLog the error and send the same request repeatedly
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error meaning

    "AUTH_FAILED" means authentication failed, likely due to an invalid or expired token.
  2. Step 2: Decide appropriate client action

    The client should ask the user to login again to get a valid token.
  3. Final Answer:

    Prompt the user to login again -> Option C
  4. Quick Check:

    AUTH_FAILED means re-authenticate user [OK]
Quick Trick: AUTH_FAILED means user must re-login to get a valid token [OK]
Common Mistakes:
  • Retrying without fixing authentication
  • Ignoring the error
  • Sending repeated requests without changes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes