Skip to main content

OIDC Provider

Package: @nauth-toolkit/oidc-provider Type: Provider Package

Turns a nauth-toolkit application into an OAuth 2.0 authorization server and OpenID Connect provider, so other applications can offer "Sign in with your app". The protocol is implemented by oidc-provider; this package supplies storage, accounts, and a login and consent bridge.

npm install @nauth-toolkit/oidc-provider oidc-provider
For third-party integrations, not your own login

Keep your own application on AuthService. The protocol endpoints here do not carry nauth-toolkit's per-identifier rate limiting or account lockout — see when to use this, and when not to.

Entry points​

ImportContents
@nauth-toolkit/oidc-providerFramework-agnostic: provider factory, bridge, mounting, rate limiter, session terminator
@nauth-toolkit/oidc-provider/nestjsOIDCProviderModule, injection tokens, the shipped interaction controller

API​

SymbolPurpose
createNAuthOIDCProvider()Build a provider wired to nauth-toolkit's storage and users
createOIDCInteractionController()The shipped NestJS controller for the interaction routes
createOIDCRateLimiter()Rate limit the provider's endpoints
mountOIDCProviderExpress() / mountOIDCProviderNest()Attach the provider to the platform instance
OIDCInteractionBridgeDrive the login and consent steps
OIDCProviderModuleNestJS registration
OIDCSessionTerminatorEnd the provider's sessions and grants

Types​

TypePurpose
InteractionRedirectDTOWhere to send the browser after a decision
InteractionStateDTOWhat the consent screen needs in order to ask
NAuthOIDCClientStatically registered client metadata
NAuthOIDCOptionsEverything the provider factory takes

Errors​

Every bridge failure is an NAuthException, so NAuthHttpExceptionFilter maps it to a status the frontend can act on.

CodeStatusWhen
OIDC_INTERACTION_NOT_FOUND404The request expired or was already resolved
OIDC_LOGIN_REQUIRED401Recoverable — details.uid says what to resume

An account the session gate refuses does not raise an error. The interaction resolves with access_denied, so the relying party gets a protocol error instead of a dead browser tab. AuthErrorCode.OIDC_ACCESS_DENIED (403) exists for identity-provider routes you write yourself.

Endpoints​

With the default pathPrefix of /oidc:

PathPurpose
/.well-known/openid-configurationDiscovery — at the origin root, not under the prefix
/oidc/authAuthorization
/oidc/jwksSigning keys
/oidc/meUserInfo
/oidc/session/endRP-initiated logout
/oidc/tokenToken
/oidc/token/introspectionIntrospection
/oidc/token/revocationRevocation

The interaction routes the consent screen calls are not here — they are ordinary routes in your own application, at oidc/interaction/:uid under any global prefix. See createOIDCInteractionController.

What's Next​