Securing Web APIs from JavaScript/SPA Applications
summary
Explains concrete patterns: use OpenID Connect + OAuth2 to get an ID token (for UI) and an access token (for APIs), prefer the authorization code flow with PKCE from browsers, and avoid refresh tokens in SPAs today. Demonstrates the oidc-client JavaScript library talking to IdentityServer, storing tokens in sessionStorage, doing silent renew via an iframe (prompt=none) and validating bearer tokens on the API. Covers CSP, CSRF and same-site cookie tradeoffs and how each approach actually prevents specific attacks.
AI-written summary · about
chapters (16)
- 0:00Start
- 2:00Outline
- 2:38Styles of JavaScript browser-based apps
- 4:25Threats against JavaScript apps
- 10:48CSRF mitigation with anti-forgery tokens
- 16:11Token based authentication
- 18:02Client, token server, and API
- 18:36Protocol flows
- 21:17Token server endpoints
- 21:49Discovery endpoint
- 22:22Authorization request
- 24:15Authorization response
- 27:43Token endpoint exchange
- 40:29Validating access tokens at API
- 57:59Renewing access tokens
- 58:12Summary
related talks
57mBuilding Clients for OpenID Connect/OAuth 2-based Systems
58mBuilding JavaScript and mobile/native Clients for Token-based Architectures
01h 01mBuilding Clients for OpenID Connect/OAuth 2-based Systems
39mSecuring your apps with OAuth2 and OpenID Connect
37mOAuth2 and OpenID Connect for Single Page Applications
44mThe Art of Authentication for Web Apps
30mStandards-based authentication for JavaScript sites
01h 00mOAuth – the good Parts
