Reference
@muze-nl/metro-oidc reference
oidcmw(options)
Adds OpenID Connect authorization to a Metro client. By default it tries the request first and authorizes after a 401 or 403. Set force_authorization: true to authorize immediately.
Important options: issuer, client_info, client, openid_configuration, oauth2, store, scope, nonce, use_dpop, force_authorization, and authorize_callback.
use_dpop defaults to true. Disable it only for providers or tests that do not support DPoP.
discover(options)
Fetches OIDC discovery metadata. Pass a Metro client with client when you want custom middleware or tests.
register(options)
Performs dynamic client registration and returns client information. oidcmw() calls this automatically when no client_info.client_id is present and the issuer supports registration.
ID token helpers
Returns the stored raw ID token or validated claims. Pass the same issuer or store used by the middleware.
validateIdToken(idToken, options)
Validates the token signature and standard claims, including issuer, audience, expiry, required claims, and nonce.
Store
Creates a simple storage object backed by localStorage when available or memory otherwise.
Test mock server
The mock server exposes discovery metadata, dynamic client registration, JWKS, signed ID tokens, userinfo, and OAuth2-backed protected-resource behaviour for tests.