Bird
Raised Fist0

A developer wrote this OAuth 2.0 token request:

medium📝 Debug Q6 of Q15
Rest API - Authentication and Authorization
A developer wrote this OAuth 2.0 token request:
POST /token
Content-Type: application/json
{"code": "abc123"}

Why might this request fail?
ABecause the token endpoint URL is incorrect
BBecause the HTTP method should be GET
CBecause the authorization code is invalid
DBecause the client credentials are missing
Step-by-Step Solution
Solution:
  1. Step 1: Check required parameters for token request

    OAuth 2.0 token requests require client credentials along with the authorization code.
  2. Step 2: Analyze given request

    The request only sends the code, missing client ID and secret, so it will fail.
  3. Final Answer:

    Because the client credentials are missing -> Option D
  4. Quick Check:

    Missing client credentials = request fails [OK]
Quick Trick: Token requests need client credentials too [OK]
Common Mistakes:
MISTAKES
  • Using GET instead of POST
  • Assuming code is invalid without checking
  • Ignoring client credentials requirement

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes