NestAuthModule
Full reference for `NestAuthModule.forRoot()` and `forRootAsync()`.
NestAuthModule is the entry point for the entire library. You import it once in your AppModule and pass an IAuthModuleOptions config object.
Synchronous form
Async form
For when your config depends on something injectable (e.g. a ConfigService):
You can also use useClass or useExisting patterns — see IAuthModuleAsyncOptions.
Top-level options
Required
| Option | Type | Notes |
|---|---|---|
appName | string | Used in TOTP issuer, audit events, and error messages |
Core
| Option | Type | Default | Notes |
|---|---|---|---|
isGlobal | boolean | false | Marks the module as global so you don't need to re-import it in every feature module |
enableAutoRefresh | boolean | true | Server-side support for auto-refresh on 401 |
Authentication methods
Registration
collectProfileFields is metadata for the public /auth/client-config endpoint — your signup form can render itself dynamically based on the server's policy.
Sessions & tokens
See Sessions & Tokens for the conceptual overview. Full options:
MFA
See MFA.
Multi-tenancy
See Multi-Tenancy.
Authorization
Password & OTP
Hooks
Every config-time hook is on the Hooks Reference page. The high-level groupings:
Audit
Admin console
See Admin Console.
Debug
See Logging & Debugging.
Related
- Setup Checklist — boot-time wiring around the module.
- Hooks Reference — every hook with execution-order timeline.
- API Reference: Types — auto-generated
IAuthModuleOptionsdefinition.