Recall & Review
beginner
What is Basic Authentication in REST APIs?
Basic Authentication is a simple method to secure REST APIs by sending a username and password encoded in Base64 with each request.
Click to reveal answer
beginner
How is the username and password sent in Basic Authentication?
They are combined as 'username:password', then encoded using Base64, and sent in the HTTP header as 'Authorization: Basic <encoded_string>'.
Click to reveal answer
intermediate
Why is Basic Authentication considered insecure over plain HTTP?
Because the Base64 encoded credentials can be easily decoded if intercepted, so it should only be used over HTTPS to encrypt the connection.
Click to reveal answer
intermediate
What HTTP status code does a server return when Basic Authentication fails?
The server returns 401 Unauthorized status code and includes a 'WWW-Authenticate' header to prompt the client for credentials.
Click to reveal answer
beginner
How does a client include Basic Authentication credentials in a REST API request?
The client adds an HTTP header: 'Authorization: Basic <Base64 encoded username:password>'.
Click to reveal answer
What does the 'Authorization' header contain in Basic Authentication?
✗ Incorrect
Basic Authentication sends 'Authorization: Basic '.
Why should Basic Authentication be used only over HTTPS?
✗ Incorrect
Base64 encoding is just encoding, not encryption, so credentials can be intercepted if not sent over HTTPS.
What HTTP status code indicates failed Basic Authentication?
✗ Incorrect
401 Unauthorized means the client must provide valid credentials.
How are username and password combined before encoding in Basic Authentication?
✗ Incorrect
They are combined as 'username:password' before Base64 encoding.
Which header does the server send to request Basic Authentication credentials?
✗ Incorrect
The server sends 'WWW-Authenticate' header to ask the client for credentials.
Explain how Basic Authentication works in REST APIs.
Think about how credentials are sent and protected.
You got /4 concepts.
Describe why Basic Authentication is not secure on its own and how to improve its security.
Focus on the difference between encoding and encryption.
You got /4 concepts.