Basic Authentication

A Web client cannot predict whether a particular resource is protected with basic authentication prior to requesting it. For this reason, the initial request for a protected resource is no different than any other request. The response returned by the server is the first indication to the client that the resource is protected. Thus, the series of events in basic authentication consists of two complete HTTP transactions. The steps involved are as follows:

1.
The Web client requests a resource that is protected by basic authentication from the Web server.
2.
The Web server returns an HTTP response with a 401 Unauthorized status code.
3.
The Web client prompts the user for a username and password, and then makes a second ...

Get HTTP Developer’s Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.