Bird
0
0

What is the correct Authorization header value for username 'admin' and password '1234' using Basic Authentication?

medium📝 Predict Output Q4 of 15
Rest API - Authentication and Authorization
What is the correct Authorization header value for username 'admin' and password '1234' using Basic Authentication?
Note: Use standard Base64 encoding.
AAuthorization: Basic MTIzNDo=
BAuthorization: Basic YWRtaW46MTIzNA
CAuthorization: Basic admin:1234
DAuthorization: Basic YWRtaW46MTIzNA==
Step-by-Step Solution
Solution:
  1. Step 1: Concatenate username and password

    Combine 'admin' and '1234' with a colon: 'admin:1234'.
  2. Step 2: Base64 encode the string

    Encoding 'admin:1234' in Base64 results in 'YWRtaW46MTIzNA=='.
  3. Step 3: Form the Authorization header

    Prefix with 'Basic ' to get 'Authorization: Basic YWRtaW46MTIzNA=='.
  4. Final Answer:

    Authorization: Basic YWRtaW46MTIzNA== -> Option D
  5. Quick Check:

    Check Base64 encoding includes padding '==' [OK]
Quick Trick: Encode 'username:password' in Base64 with padding [OK]
Common Mistakes:
  • Omitting Base64 padding characters
  • Not encoding the colon separator
  • Using plain text instead of Base64

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes