Security
Security is not a feature you bolt on; it is a set of concerns that touch every endpoint. This module covers the ones every API must address.
The surface
Section titled “The surface”flowchart TD API --> T[Transport: HTTPS everywhere] API --> AuthN[Authentication: who are you?] API --> AuthZ[Authorization: what may you do?] API --> In[Input: validate everything] API --> Ab[Abuse: rate limiting & quotas]
- Transport — serve only over HTTPS; never accept credentials over plain HTTP.
- Authentication — establish who the caller is (API key, token).
- Authorization — decide what that caller may do.
- Input — treat every byte from the client as untrusted; validate it.
- Abuse — protect the API from being overwhelmed or scraped.
What this module covers
Section titled “What this module covers”- Authn vs authz — the difference, and
401vs403. - Tokens, JWT & OAuth — bearer tokens and delegated access.
- CORS — how browsers gate cross-origin calls.
- Rate limiting & validation — throttling and trusting nothing.