0 of 3 done
Two different questions that get collapsed into one word: authentication (who are you) and authorization (what may you do). Different failure modes, different status codes, different places in the request lifecycle.
- Authentication Flows — [Intermediate] — sessions vs tokens, JWT’s real tradeoffs, password storage
- Authorization — [Intermediate] — RBAC/ABAC/ReBAC, and why authz ≠ authn
- OAuth Provider Integrations — [Advanced] — the flows in practice
The three rules
- Authorise at the data layer, on every request. Hiding a button is UX. The most common real authorization bug is IDOR — accepting a resource ID from the user and returning it without checking ownership.
- Sessions vs JWT is a revocation-vs-lookup tradeoff. Sessions revoke instantly and cost a lookup; JWTs need no lookup and cannot be revoked before expiry. Most applications should use sessions; JWTs shine for service-to-service and short-lived access tokens paired with a revocable refresh token.
- Pin the JWT algorithm server-side. Never trust the token’s own
algheader — that’salg: noneand algorithm-confusion attacks. And a JWT is signed, not encrypted: anyone can read the payload.
Related
- API authentication — tokens, JWT pitfalls, and the API-specific auth story
- Backend course
- Interview: auth questions — sessions vs JWT, OAuth + PKCE, password storage
- Web Security · TLS
- gees-arise: Postgres RLS — authorization enforced at the data layer, for real
Jump to a subject
Software engineering
Infrastructure & security
Computer science
Hardware & engineering