Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

What Is HTTP Authentication? Challenges, Headers, and Status Codes

Follow an HTTP authentication exchange, compare Basic, Digest, and Bearer, and distinguish 401, 403, and proxy authentication.

Table of Contents

HTTP authentication lets a server challenge a client for credentials before serving a protected resource. A typical challenge uses a 401 Unauthorized response with a WWW-Authenticate header. The client can retry with credentials in an Authorization header.

What is HTTP Authentication? 5 Stages of HTTP Authentication Picture 1

Follow a typical challenge and response

  1. A client requests a protected resource.
  2. The origin server sends a 401 challenge if it needs valid credentials.
  3. The client selects a supported scheme and retries with credentials. Some clients send credentials on the first request.
  4. The server checks the credentials and the permissions for that resource. If it refuses access after authentication, it may return 403 Forbidden.

What is HTTP Authentication? 5 Stages of HTTP Authentication Picture 2

Compare Basic, Digest, and Bearer

  • Basic: Uses a Base64-encoded username and password. Base64 is reversible. Use HTTPS to protect the credential in transit.
  • Digest: Uses a server challenge and a computed response. The digest is a hash, and supported algorithms and clients vary.
  • Bearer: Sends an access token. Protect it like a password because possession can grant access until the token expires or is revoked. OAuth can issue access tokens, while JWT is one possible token format.

Recognize a separate proxy challenge

A proxy can return 407 Proxy Authentication Required with Proxy-Authenticate. The client responds with Proxy-Authorization for that proxy. This exchange is separate from authentication with the origin server.

See RFC 9110 for the protocol and TipsMake’s guides to HTTP responses and API debugging for practical examples.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.