8. OAuth 2.0, OpenID Connect and authorization
Answer as submitted
“Yes — OAuth2 (PKCE, client credentials) and OIDC/JWT with Entra ID, Keycloak and Auth0.”
Expanded answer
Yes. Public clients use Authorization Code with PKCE and service-to-service calls use client credentials, both against an OpenID Connect provider — Microsoft Entra ID, Keycloak or Auth0 — discovered through its /.well-known/openid-configuration and JWKS endpoints. The API validates issuer, audience, lifetime and signature keys on every request instead of decoding a token and trusting it, authorization is expressed as policies over scopes and claims, refresh tokens rotate with reuse detection, and the hardening around it covers short lifetimes, CSRF/CORS strategy, secret management and audit logging.
| Decision | Typical implementation | Why it is done this way |
|---|---|---|
| Public client flow | response_type=code + S256 PKCE | No secret in the browser; an intercepted code is useless without the verifier. |
| Service-to-service | grant_type=client_credentials | No user context; a scoped token per calling service. |
| Token validation | Issuer + audience + lifetime + JWKS keys | A decoded token is never trusted; signatures are verified against published keys. |
| Authorization | Policy over scopes and claims | Least privilege is declared once and enforced everywhere, instead of role strings per endpoint. |
| Session longevity | Short access token, rotated refresh token | Limits the window of a stolen token; reuse detection revokes the family. |
| Hardening | CSRF/CORS allow-lists, secret vault, audit log | Closes the paths around the protocol itself. |
Live identity workflow proof
The running component below changes its protocol/result view through real event binding. Select a step to see the exact request, what the security decision depends on, and the observable outcome.
Choose an identity step
Select a step to inspect the protocol request, the reasoning and the result produced.
$ GET /authorize?response_type=code&code_challenge=<S256>&code_challenge_method=S256
The browser is sent to the identity provider with PKCE, so the client never sees the user credentials and an intercepted code is useless without the verifier.
302 → idp/authorize · state + nonce bound to the session code_challenge_method=S256 · redirect_uri exact match
How the implementation stays safe
Source files
Select a file to inspect the proof with syntax highlighting and line numbers. The first file is the code running the component above; the other two are the production shapes of the same decisions.
Acceptance criteria
- Names OAuth 2.0 and OpenID Connect and the flow used by each client type.
- Distinguishes authorizing, token exchange, validation, policy and refresh.
- Shows an interactive proof of choosing a protocol step and reading its result.
- Validates issuer, audience, lifetime and signature instead of trusting a decoded token.
- Defers tenant configuration, legacy federation and pen-test remediation to a later topic.