Bird
Raised Fist0

What is wrong with this Basic Authentication header?

medium📝 Debug Q14 of Q15
Rest API - Authentication and Authorization
What is wrong with this Basic Authentication header?
Authorization: Basic user:pass
AThe username and password are not base64 encoded
BThe header should be 'Bearer' not 'Basic'
CThe colon ':' should be replaced with a comma ','
DThe header is missing the word 'Authorization'
Step-by-Step Solution
Solution:
  1. Step 1: Check the format of the Authorization header

    The header must have the credentials base64 encoded after 'Basic '.
  2. Step 2: Identify the error in the given header

    The given header has 'user:pass' in plain text, not base64 encoded.
  3. Final Answer:

    The username and password are not base64 encoded -> Option A
  4. Quick Check:

    Basic Auth requires base64 encoding [OK]
Quick Trick: Credentials must be base64 encoded, not plain text [OK]
Common Mistakes:
MISTAKES
  • Sending plain text credentials
  • Confusing 'Basic' with 'Bearer'
  • Misplacing colon or other punctuation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes