"Every HTTP authentication scheme — JWT, OAuth, API keys, session cookies, AWS SigV4 — fits into one of two shapes: send something with the request that proves who you are, or send something the server set in your last response. Basic and Bearer are the first two patterns the protocol shipped."
The Authorization Header — One Header, Many Schemes
HTTP defines a single header for authentication credentials: Authorization. Its value is always <scheme> <credentials>. The scheme tells the server how to interpret the credentials.
The original two schemes — defined in RFC 7235 — are Basic and Bearer. Modern auth flows (OAuth2, JWT) all use the Bearer scheme; the token's format and lifecycle vary, but the wire shape is identical.
HTTP Basic — The Original Scheme
Basic carries username and password directly:
Authorization: Basic cGlwcGE6c2VjcmV0MTIz
The credentials part is base64("username:password") — that's pippa:secret123 in the example above. Anyone who reads the wire (network sniffer, leaked log, intermediate proxy without TLS) can base64-decode and recover the exact password. Base64 is encoding, not encryption.
For this reason, Basic without TLS is broadcasting the password to anyone on the network path. With TLS, it's a workable scheme for internal tooling and quick prototypes — but production APIs almost never use it because the user's password ends up on every request, increasing leak surface.
HTTP Bearer — Separating the Credential from the Password
Bearer carries an opaque token:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1XzQyIn0.signature
The token was issued by some earlier process — a login endpoint, an OAuth authorization, an API key generator. The server validates the token (lookup in a database, signature check on a JWT, OAuth introspection) and grants whatever the token authorizes. The user's original password is not in the request.
Benefits:
- Separable. Token ≠ password. Compromised token revokes; user keeps password.
- Revocable. Server can blacklist a token instantly; can't unsay a password reuse.
- Short-lived possible. Token can expire in minutes; password can't.
- Scope-limitable. Token can grant subset of user's full powers; password grants everything.
This is why every modern API uses Bearer. The token's INTERNAL shape — opaque random string, JWT, encrypted blob — is the next lesson; the WIRE shape is just Authorization: Bearer <whatever>.
WWW-Authenticate — The Server's Auth Challenge
When the client sends no credentials (or invalid ones), the server returns 401 Unauthorized with a WWW-Authenticate response header telling the client WHAT scheme to use:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="api", error="invalid_token"
Content-Type: application/json
{"error": {"code": "unauthenticated", "message": "..."}}
The browser uses this header to display the native login dialog (for Basic). Programmatic clients use it to know which token type to send. Most APIs in 2026 skip WWW-Authenticate (the docs tell the client what to send) — but it's the official discovery mechanism.
Custom Schemes — When Basic and Bearer Aren't Enough
Some APIs invent their own scheme name. AWS uses Authorization: AWS4-HMAC-SHA256 ... — a request-signing scheme where the credentials are a per-request HMAC over the request bytes. Cloudflare uses X-Auth-Key as a separate header (RFC violation, but common). Stripe uses Bearer for the API key.
Inventing a new scheme is rarely worth it. The two standard patterns plus the cookie-based session pattern cover essentially every legitimate use case, and HTTP intermediaries (proxies, logging tools, gateways) handle the standards correctly.
cwkPippa's Auth Reality
Authorization: Bearer <admin-token> check. No Basic anywhere. The frontend stores the token in an HttpOnly cookie and the backend reads it via FastAPI dependency injection. Standard shape, minimal scheme count.