Skip to main content

AuthChallengeDTO

Package: @nauth-toolkit/core Type: DTO (Request/Response)

Data transfer objects for authentication challenges: response DTO and legacy completion request DTO.

import { AuthChallengeResponseDTO, ChallengeResponseRequestDTO, AuthChallenge } from '@nauth-toolkit/nestjs';

AuthChallengeResponseDTO​

Challenge response DTO (primarily used in responses).

PropertyTypeRequiredDescription
challengeNameAuthChallengeYesChallenge type. Must be: VERIFY_EMAIL, VERIFY_PHONE, MFA_REQUIRED, MFA_SETUP_REQUIRED, FORCE_CHANGE_PASSWORD.
sessionstringYesChallenge session token. UUID v4 format. Trimmed and lowercased.
challengeParametersRecord<string, unknown>YesChallenge-specific parameters object.
substringYesUser identifier. UUID v4 format. Trimmed and lowercased.

ChallengeResponseRequestDTO​

Legacy challenge completion request DTO (kept for backwards compatibility).

PropertyTypeRequiredDescription
sessionstringYesChallenge session token. UUID v4 format. Trimmed and lowercased.
challengeNameAuthChallengeYesChallenge type enum value.
challengeResponsesRecord<string, unknown>YesChallenge-specific responses object.

AuthChallenge enum​

Represents the challenge type returned by the auth flow.

  • VERIFY_EMAIL
  • VERIFY_PHONE
  • MFA_REQUIRED
  • MFA_SETUP_REQUIRED
  • FORCE_CHANGE_PASSWORD

Example​

Challenge Response:

{
"challengeName": "VERIFY_EMAIL",
"session": "a21b654c-2746-4168-acee-c175083a65cd",
"challengeParameters": {
"email": "user@example.com"
},
"sub": "b32c765d-3857-5279-bdff-d286194b76de"
}

Used By​