Bird
0
0

You want to protect a REST API endpoint using Basic Authentication. Which of the following is the best practice?

hard📝 Application Q15 of 15
Rest API - Authentication and Authorization
You want to protect a REST API endpoint using Basic Authentication. Which of the following is the best practice?
AUse HTTPS to encrypt the connection and send base64 encoded credentials in the Authorization header
BSend username and password in plain text over HTTP
CSend credentials as URL parameters for easy access
DUse Basic Authentication without encoding credentials
Step-by-Step Solution
Solution:
  1. Step 1: Understand security risks of Basic Authentication

    Basic Auth sends credentials encoded but not encrypted, so it must be used over HTTPS to protect data.
  2. Step 2: Identify best practice for secure API protection

    Using HTTPS encrypts the entire connection, making base64 encoded credentials safe to transmit.
  3. Final Answer:

    Use HTTPS to encrypt the connection and send base64 encoded credentials in the Authorization header -> Option A
  4. Quick Check:

    Basic Auth + HTTPS = secure transmission [OK]
Quick Trick: Always use HTTPS with Basic Auth for security [OK]
Common Mistakes:
  • Sending credentials over HTTP (not secure)
  • Putting credentials in URL parameters
  • Skipping base64 encoding

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes