Skip to main content

AuthChallenge

Package: @nauth-toolkit/client Type: Enum

Enumeration of challenge types returned by the backend when authentication requires additional verification steps.

import { AuthChallenge } from '@nauth-toolkit/client';

Values

ValueDescriptionWhen Returned
VERIFY_EMAILEmail verification requiredAfter signup/login when email not verified
VERIFY_PHONEPhone verification requiredAfter signup/login when phone not verified or phone collection needed
MFA_REQUIREDMulti-factor authentication requiredAfter successful credentials when MFA enabled for user
MFA_SETUP_REQUIREDMFA device setup requiredWhen MFA enforcement requires user to configure first device
FORCE_CHANGE_PASSWORDPassword change requiredAfter admin reset or policy requires password update

Challenge Parameters

Each challenge type includes specific parameters in AuthResponse.challengeParameters:

ChallengeParameters
VERIFY_EMAILcodeDeliveryDestination (masked email), instructions
VERIFY_PHONEcodeDeliveryDestination (masked phone), requiresPhoneCollection, instructions
MFA_REQUIREDpreferredMethod, availableMethods, maskedPhone, maskedEmail, instructions
MFA_SETUP_REQUIREDallowedMethods, instructions
FORCE_CHANGE_PASSWORDinstructions

See Challenge Handling Guide for detailed parameter usage.

Example

import { AuthChallenge } from '@nauth-toolkit/client';

// Check challenge type
if (response.challengeName === AuthChallenge.VERIFY_EMAIL) {
// Navigate to email verification page
router.navigate(['/verify-email']);
} else if (response.challengeName === AuthChallenge.MFA_REQUIRED) {
// Check MFA method from parameters
const method = response.challengeParameters?.preferredMethod;
if (method === 'passkey') {
router.navigate(['/mfa/passkey']);
} else {
router.navigate(['/mfa']);
}
}

The SDK supports automatic navigation to challenge routes. See Challenge Handling Guide for all patterns:

  • Separate Routes - /auth/challenge/verify-email, /auth/challenge/mfa-required
  • Single Route - /auth/challenge?challenge=VERIFY_EMAIL
  • Custom Routes - Map each challenge to custom URLs
  • Dialog-Based - Handle challenges without navigation

See NAuthClientConfig.redirects for configuration.

Used By