Skip to article frontmatterSkip to article content

a summary of various common web authentication techniques

Session-based Authentication

Example:

POST /login
→ Set-Cookie: session_id=abc123

Subsequent requests include the session ID:

GET /profile
Cookie: session_id=abc123

API Key Authentication

Example:

GET /data
x-api-key: abc123xyz456

Token-based Authentication (JWT)

Example:

 GET /profile
Authorization: Bearer eyJhbGciOi...

🔗 OAuth 2.0

OAuth is about Delegated Access:

Basic flow:

  1. App redirects to provider’s auth page

  2. User logs in and consents

  3. Provider redirects back with a code

  4. App exchanges code for access token

Example exchange:

POST /oauth/token
→ { "access_token": "abc123" }

🔒 Multi-Factor Authentication (MFA)

Examples:

Greatly reduces the risk of compromised accounts