How panva/openid-client works
openid-client is a JavaScript OAuth 2.0 and OpenID Connect client library. An application discovers an authorization server, builds an authorization request, receives the user’s redirect callback, exchanges the authorization response for tokens, and can then call protected resources. The API also supports other grant types, token and UserInfo operations, and JWT- and proof-of-possession-based extensions; Passport integration is a separate adapter. Most runtime capabilities are implemented in one large source file. Relationships shown here follow the README’s documented workflow and feature list; sampled source excerpts do not expose every implementation path.
Main entry points: index.ts Code Grant & Callback · passport.ts Passport Strategy
Components 13
Client API
- Discovery & Registration
src/index.ts - OAuth/OIDC Extensions
src/index.ts
Authorization Flows
- Authorization Requests
src/index.ts - Code Grant & Callback
src/index.ts - Other Grants
src/index.ts
Token Operations
- Token Validation
src/index.ts - Resource Requests
src/index.ts - Introspection & Revocation
src/index.ts
Framework Adapters
- Passport Strategy
src/passport.ts
Other components
- Application
- End User
- Authorization Server
- Protected Resource
Connections 18
- Application → Discovery & Registration: discovers server
README.md - Discovery & Registration → Authorization Server: fetches metadata
README.md - Application → Authorization Requests: builds request
README.md - Authorization Requests → End User: redirects user
README.md - End User → Authorization Server: authorizes at
README.md - Authorization Server → Application: redirects callback
README.md - Application → Code Grant & Callback: exchanges callback
README.md - Code Grant & Callback → Authorization Server: requests tokens
README.md - Application → Other Grants: requests grant
README.md - Other Grants → Authorization Server: requests tokens
README.md - Application → Resource Requests: requests resource
README.md - Resource Requests → Protected Resource: sends access token
README.md - Application → Introspection & Revocation: manages tokens
README.md - Introspection & Revocation → Authorization Server: introspects or revokes
README.md - Application → OAuth/OIDC Extensions: uses extensions
README.md - OAuth/OIDC Extensions → Authorization Server: sends extended requests
README.md - Application → Passport Strategy: uses strategy
README.md - Passport Strategy → Code Grant & Callback: supports authentication flow
src/passport.ts