Authentication System
Environment variables for sign-up, login, email verification, password reset, two-factor authentication, passkeys, sessions, and the user management scripts.
What users see when they sign up and sign in is described on the Authentication feature page. Provider-specific setup lives in the OAuth2 and OpenID Connect, SAML, LDAP, email, and passkeys guides. Allowed email domains and the order of the login buttons are set in the registration block of intelliask.yaml.
In a single-tenant deployment, the first account registered gets the ADMIN role, so create it yourself before opening registration to others, and make it a local email and password account. Tenant-scoped deployments never promote their first user; provision tenant admins through a trusted administrative flow.
General
| Key | Type | Description | Example |
|---|---|---|---|
| ALLOW_EMAIL_LOGIN | boolean | Show the email login form and accept local or LDAP credential logins through the authentication API. | ALLOW_EMAIL_LOGIN=true |
| ALLOW_EMAIL_LOGIN_OVERRIDE | boolean | Still accept email login through the API while ALLOW_EMAIL_LOGIN is false. Each use is logged. Commented out by default. | # ALLOW_EMAIL_LOGIN_OVERRIDE=false |
| ALLOW_REGISTRATION | boolean | Enable or disable Email registration of new users. | ALLOW_REGISTRATION=true |
| ALLOW_SOCIAL_LOGIN | boolean | Allow users to connect to IntelliAsk with various social networks. | ALLOW_SOCIAL_LOGIN=false |
| ALLOW_SOCIAL_REGISTRATION | boolean | Enable or disable registration of new users using various social networks. | ALLOW_SOCIAL_REGISTRATION=false |
| ALLOW_ACCOUNT_DELETION | boolean | Show the Delete account option in Settings > Account. Enabled when unset. | # ALLOW_ACCOUNT_DELETION=true |
| ALLOW_EMAIL_CHANGE | boolean | Let email and password users change their email address from Settings > Account (needs email configured). Enabled when unset. emailChange in intelliask.yaml takes precedence. See Email address change on the email setup page. | # ALLOW_EMAIL_CHANGE=true |
Note: OpenID and SAML do not support the ability to disable only registration.
Setting ALLOW_EMAIL_LOGIN=false hides the email login form and rejects local or LDAP credential requests to /api/auth/login; OAuth, OpenID Connect, and SAML sign-in are unaffected. ALLOW_EMAIL_LOGIN_OVERRIDE=true is intended only for a controlled API integration that still needs credential login while the form is hidden. Every override use logs the request IP, so protect and monitor that route carefully.
Quick Tips:
- Even with registration disabled, you can add users directly to the database using the create-user script detailed below.
- To delete a user, you can use the delete-user script also detailed below.

Email verification and password reset
When an email service is configured, new email and password accounts get a verification link. Without one, accounts are marked verified as soon as they are created.
| Key | Type | Description | Example |
|---|---|---|---|
| ALLOW_UNVERIFIED_EMAIL_LOGIN | boolean | Let users sign in before verifying their email. When false, unverified users cannot sign in, and accounts that are never verified are deleted after one week. | ALLOW_UNVERIFIED_EMAIL_LOGIN=true |
| ALLOW_PASSWORD_RESET | boolean | Show the Forgot Password? link and allow password resets through configured email delivery. Links are valid for 15 minutes, and a successful reset ends the account's sessions. Reset credentials are never returned on the page. | ALLOW_PASSWORD_RESET=false |
Two-factor authentication
Email and password users and LDAP users can always turn on 2FA themselves from Settings > Account. Accounts that sign in through OAuth, OpenID Connect, or SAML do not get the option, because their identity provider is responsible for MFA.
Required two-factor authentication
Set ENFORCE_TWO_FACTOR_AUTHENTICATION=true to make 2FA mandatory for local and LDAP accounts:
- A user without 2FA who signs in (with a password, LDAP credentials, or a passkey) gets no session until setup is done. They land on the Two-Factor Authentication Required screen, scan a QR code, confirm a code, and save their backup codes. The setup session lasts 10 minutes; if it expires, they start again from the login page.
- Users who are already signed in are sent into the same setup the next time their session is checked or refreshed, and access tokens issued before enrollment stop working.
- After enrollment, the Disable 2FA control shows Required by administrator and the server refuses to turn 2FA off. Users can still regenerate backup codes.
- A federated account that tries to sign in with a password while enforcement is on is told to use its identity provider.
| Key | Type | Description | Example |
|---|---|---|---|
| ENFORCE_TWO_FACTOR_AUTHENTICATION | boolean | Require local and LDAP accounts to enroll in 2FA before a full session is issued. Default: false. | ENFORCE_TWO_FACTOR_AUTHENTICATION=false |
| TWO_FACTOR_BACKUP_CODE_FORMAT | string | Format of newly issued backup codes: strong (default) or legacy. See Backup-code compatibility below. | # TWO_FACTOR_BACKUP_CODE_FORMAT=strong |
ENFORCE_TWO_FACTOR_AUTHENTICATION and the 2FA attempt limits are process-wide environment settings. They apply before any request or tenant configuration is available, so they cannot be set in intelliask.yaml or per tenant; set the same values on every replica. The code-attempt limits (TWO_FACTOR_TEMP_*, TWO_FACTOR_SETUP_*) are on the Automated Moderation page. The separate budget for managing 2FA from Settings is rateLimits.twoFactorManagement in intelliask.yaml.
Passkeys
Passkeys (WebAuthn) let users sign in with a device screen lock or a security key. They are off by default; turn them on with ALLOW_PASSKEY_LOGIN=true. The relying party settings, per-user limit, and rate limits are on the Passkeys page.
Session Expiry and Refresh Token
SESSION_EXPIRY is how long an access token lasts (15 minutes by default); it is renewed automatically in the background. REFRESH_TOKEN_EXPIRY is how long a user stays signed in (7 days by default). Each renewal issues a new refresh token tied to the same session and its original expiry, so the window counts from login and activity does not extend it. If users are signed out sooner than you want, raise REFRESH_TOKEN_EXPIRY.
With OPENID_REUSE_TOKENS=true, the session cookie holds the identity provider's refresh token instead, so the provider's lifetime, rotation, and revocation policy decide when the session ends; REFRESH_TOKEN_EXPIRY cannot extend an expired or revoked IdP token.
| Key | Type | Description | Example |
|---|---|---|---|
| SESSION_EXPIRY | integer (milliseconds) | Session expiry time. | SESSION_EXPIRY=1000 * 60 * 15 |
| REFRESH_TOKEN_EXPIRY | integer (milliseconds) | Refresh token expiry time. | REFRESH_TOKEN_EXPIRY=(1000 * 60 * 60 * 24) * 7 |
| SESSION_COOKIE_SECURE | boolean | Force the Secure attribute on session and auth cookies on (true) or off (false). Leave unset to decide from NODE_ENV and DOMAIN_SERVER. Set false only for plain HTTP deployments where browsers drop Secure cookies. | # SESSION_COOKIE_SECURE=false |
JWT Secret and Refresh Secret
- If these are left blank, IntelliAsk generates temporary secrets in
.env.temp. Set your own persistent values before running a production instance. The examples given are 32-byte keys (64 characters in hex).- Use this tool to generate some quickly: JWT Keys
| Key | Type | Description | Example |
|---|---|---|---|
| JWT_SECRET | string (hex) | JWT secret key. | JWT_SECRET= |
| JWT_REFRESH_SECRET | string (hex) | JWT refresh secret key. | JWT_REFRESH_SECRET= |
Use unique values of at least 32 bytes, store them securely, and give every IntelliAsk replica the same values. When either value is blank, IntelliAsk can generate and reuse a value from its temporary credentials file. The default Docker Compose stacks persist that file, but this is intended only as a bootstrap convenience. If the file is lost or cannot be written, sessions can become invalid after restart. See Credentials Configuration for precedence, persistence, and production guidance.
Automated Moderation
Login, registration, password reset, and 2FA attempts are rate limited, and repeated violations lead to temporary bans. See Automated Moderation.
User Management Scripts
IntelliAsk ships a set of Node scripts for managing users directly, which is useful when registration is disabled or you need to administer accounts from the server. Run them inside the intelliask container.
Use the create-user script to add users directly to the database, even when registration is disabled.
Use the intelliask binary's shell command to run a script in the container:
Available Scripts
| Key | Type | Description | Example |
|---|---|---|---|
| create-user | — | Add a new user directly to the database (works even when registration is disabled). | npm run create-user |
| invite-user | Send an invitation for a user to register. | npm run invite-user email@domain.com | |
| list-users | — | List all users in the database. | npm run list-users |
| reset-password | Reset a user's password. | npm run reset-password email@domain.com | |
| ban-user | Ban a user account. | npm run ban-user email@domain.com | |
| delete-user | Delete a user account. | npm run delete-user email@domain.com | |
| user-stats | — | Show user statistics. | npm run user-stats |
Create a User
Adds a user directly to the database, even when registration is disabled. Follow the prompts to enter the new user's email and password:
Delete a User
Removes a user account. Replace email@domain.com with the email of the user you want to delete:
Local development: If you're running IntelliAsk from source instead of the containerized stack, run these scripts from the project root without the container prefix, e.g.
npm run create-user.
Backup-code compatibility
New and regenerated backup codes default to 128-bit random values with individually salted hashes. Existing legacy codes remain usable until regenerated. TWO_FACTOR_BACKUP_CODE_FORMAT=legacy temporarily issues the older 32-bit, unsalted format. Apply it to every replica while incompatible backends or clients remain, then remove it. Do not roll back to an incompatible backend after issuing strong codes without replacing them. See rolling-deployment guidance.
Last updated on