API authentication is the process of verifying the identity of clients making requests to an API, forming the foundation of API security in modern distributed systems. Unlike traditional web authentication that relies on session cookies, API authentication must work across stateless HTTP requests, supporting diverse clients from web browsers to mobile apps and server-to-server integrations. The challenge lies in balancing security with developer experience—while robust authentication prevents unauthorized access and data breaches, overly complex implementations create friction that slows development and adoption. In 2026, the field is evolving rapidly: OAuth 2.1 consolidates best practices with mandatory PKCE and sender-constrained tokens (DPoP), passkeys/WebAuthn are accelerating mainstream adoption, and AI agents communicating via MCP are driving delegated authorization at scale.
What This Cheat Sheet Covers
This topic spans 17 focused tables and 158 indexed concepts, 138 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Core Authentication Methods
Every API auth strategy is some variation on a few primitives—a static key, a bearer token, a delegated grant, or a certificate—and knowing which one fits your situation is half the battle. The entries here span the full spectrum from the dead-simple API key suited to server-to-server traffic, through the OAuth/OIDC family that dominates modern user-facing apps, to phishing-resistant passkeys and the heavyweight enterprise options. Most are listed roughly from "reach for this today" down to "you'll only meet this in legacy systems."
| Method | Example | Description | |
|---|---|---|---|
X-API-Key: sk_live_51H... | • Static token identifying the calling application • simple but not tied to specific users, best for server-to-server calls where client identity matters more than user identity. | ||
Authorization: Bearer eyJhbGc... | • Generic token authentication scheme (RFC 6750) • the token itself carries authentication proof and must be sent with every request — stolen tokens grant full access unless sender-constrained. | ||
grant_type=authorization_code&code=xyz&redirect_uri=... | • Delegation protocol allowing third-party apps to access user resources without sharing passwords • returns access tokens for API calls. | ||
scope=openid profile email | • Authentication layer built on OAuth 2.0 • returns an ID token (JWT) containing user identity alongside access tokens for resource access. | ||
Uses Authorization Code + PKCE | • Modern OAuth profile mandating PKCE for all flows, removing implicit and password grants • the recommended standard for new implementations. | ||
eyJhbGciOiJIUzI1NiJ9.eyJzdWI... | • Self-contained token encoding claims as JSON, verifiable via signature • enables stateless authentication without database lookups per request. | ||
Client presents certificate in TLS handshake | • Both client and server authenticate via X.509 certificates • strongest authentication for service-to-service, though complex certificate management is required. | ||
Authorization: HMAC-SHA256Credential=KEY, SignedHeaders=...,Signature=abc123... | • Request signed using shared secret (e.g., AWS Signature v4) • proves request integrity and authenticity without sending the secret itself. | ||
Passkey stored in authenticator device | • Passwordless authentication using public-key cryptography and biometrics • phishing-resistant, device-bound credentials, growing mainstream adoption in 2026. | ||
Cookie: session_id=abc123; Secure;HttpOnly; SameSite=Strict | • Server stores session state tied to a cookie ID • traditional for web apps but requires server-side storage and sticky sessions in distributed deployments. | ||
Authorization: Basic dXNlcjpwYXNz | • Base64-encoded username:password sent in header• credentials sent with every request, requires HTTPS, rarely used in APIs today. | ||
XML assertion with digital signature | • Enterprise SSO standard exchanging XML assertions between identity provider and service provider • heavy XML format, primarily for web-based enterprise SSO. | ||
Authorization: Digest username="user",realm="api", nonce="..." | • Challenge-response mechanism hashing credentials with nonce • avoids plaintext passwords but MD5-based and largely obsolete in modern APIs. |