HTTP Authentication Schemes

All HTTP auth schemes — Basic, Bearer, Digest, NTLM — with syntax and security notes.

Searchable reference for HTTP authentication scheme names used in the Authorization and WWW-Authenticate headers, including Basic, Bearer, Digest, Negotiate, NTLM and SCRAM, with syntax, RFC and security guidance. Bundled offline.

What is the difference between Basic and Bearer authentication?

Basic sends a base64-encoded username and password on every request, so it must run over TLS. Bearer sends an opaque or JWT token issued by an authorization server; anyone holding the token can use it until it expires, so short lifetimes and TLS are essential.

When a server protects a resource it answers with 401 Unauthorized and a WWW-Authenticate header naming an authentication scheme; the client then resends the request with a matching Authorization header. The scheme name — Basic, Bearer, Digest, Negotiate and others — decides the entire credential format and security posture. This reference lists the registered schemes with their syntax and the caveats that matter.

How it works

HTTP authentication is a simple challenge cycle. The server’s WWW-Authenticate (or Proxy-Authenticate for proxies) lists one or more schemes and parameters such as a realm or a nonce. The client picks a scheme it supports and replies with Authorization: <scheme> <credentials>. Some schemes are single-shot (Basic, Bearer); others are multi-round handshakes that exchange several messages (Digest, Negotiate/NTLM, SCRAM).

Crucially, encoding is not encryption. Basic merely base64-encodes user:password, so it leaks credentials over plain HTTP and must run on TLS. Bearer tokens are equally sensitive — holding the token is enough to act as the user.

Tips and examples

Header forms you will see most often:

Authorization: Basic ZGVtbzpwYXNzd29yZA==
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
Authorization: Digest username="demo", realm="api", nonce="...", response="..."
Authorization: Negotiate YIIZ...   (Kerberos / SPNEGO)

For modern APIs, prefer Bearer over TLS with short-lived, signed tokens whose signature, audience and expiry you validate server-side. Reserve Basic for internal tools behind TLS, avoid NTLM in favour of Negotiate/Kerberos for Windows SSO, and reach for Digest only when you cannot use TLS but still must avoid sending the password in clear.