Wiki: OAuth Authentication
13.11.2025
TL;DR
- OAuth is a delegation protocol; authentication is layered on top.
- The authorization code flow is the standard for web apps.
- The client exchanges a code for tokens, then calls APIs.
How OAuth 2.0 Works (High Level)
- Client requests authorization from the user.
- User authenticates with the provider and grants consent.
- Client receives an authorization code.
- Client exchanges the code for tokens.
- Client uses the access token to call APIs.
Key Actors
- Client application
- Resource owner (user)
- Authorization server
- Resource server (API)
- User agent (browser/device)
Notes
- For authentication, use OpenID Connect on top of OAuth.
- Always validate
state and nonce to prevent CSRF and replay.