NewWacht Bench is live — AI-assisted development for Wacht

updateAuthSettings()

Patches auth policy fields handled by /settings/auth for the current deployment.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function updateAuth() {  const client = await wachtClient();  await client.settings.updateAuthSettings({    password_min_length: 12,    mfa_enabled: true,  });}

Signature

function updateAuthSettings(  request: {    allowed_domains?: string[];    password_min_length?: number;    password_require_uppercase?: boolean;    password_require_lowercase?: boolean;    password_require_numbers?: boolean;    password_require_special_chars?: boolean;    mfa_enabled?: boolean;    mfa_methods?: Array<'totp' | 'sms' | 'email'>;    session_timeout?: number;    refresh_token_expiration?: number;  },): Promise<void>

UpdateAuthSettingsRequest

allowed_domains?: string[] | undefined;
Allowed email/domain policy list.
password_min_length?: number | undefined;
Minimum password length.
password_require_uppercase?: boolean | undefined;
Require uppercase letters.
password_require_lowercase?: boolean | undefined;
Require lowercase letters.
password_require_numbers?: boolean | undefined;
Require numeric characters.
password_require_special_chars?: boolean | undefined;
Require special characters.
mfa_enabled?: boolean | undefined;
Enable MFA requirements.
mfa_methods?: Array<'totp' | 'sms' | 'email'> | undefined;
Enabled MFA methods.
session_timeout?: number | undefined;
Session timeout (seconds).
refresh_token_expiration?: number | undefined;
Refresh token expiration (seconds).

Patch semantics

This method sends a partial patch to /settings/auth.
Only provided fields are updated. Omitted fields are left unchanged by the backend.

Return value

The method resolves with no value when the update succeeds.

Examples

Harden password policy

import { wachtClient } from '@wacht/nextjs/server';export async function hardenPasswordPolicy() {  const client = await wachtClient();  await client.settings.updateAuthSettings({    password_min_length: 14,    password_require_uppercase: true,    password_require_lowercase: true,    password_require_numbers: true,    password_require_special_chars: true,  });}

Enable MFA and adjust session limits

import { wachtClient } from '@wacht/nextjs/server';export async function enforceMfaAndSessionLimits() {  const client = await wachtClient();  await client.settings.updateAuthSettings({    mfa_enabled: true,    mfa_methods: ['totp'],    session_timeout: 3600,    refresh_token_expiration: 60 * 60 * 24 * 30,  });}

On this page