multifactorChallenge method

Future<Challenge> multifactorChallenge({
  1. required String mfaToken,
  2. List<ChallengeType>? types,
  3. String? authenticatorId,
})

Requests a challenge for multi-factor authentication (MFA) based on the challenge types supported by the app and user.

The type is how the user will get the challenge and prove possession. Excluding this parameter means that your app accepts all supported challenge types.

Supported challenge types include:

  • otp: for one-time password (OTP).
  • oob: for SMS/voice messages or out-of-band (OOB).

Important: If OTP is supported by the user and you don't want to request a different factor, you can skip the challenge request and call loginWithOtp directly.

Endpoint

https://auth0.com/docs/api/authentication#challenge-request

Usage example

final result = await auth0.api.multifactorChallenge({
  mfaToken: 'received_mfa_token',
  types: [ChallengeType.otp, ChallengeType.oob],
  authenticatorId: 'authenticator_id'
});

Implementation

Future<Challenge> multifactorChallenge(
        {required final String mfaToken,
        final List<ChallengeType>? types,
        final String? authenticatorId}) =>
    Auth0FlutterAuthPlatform.instance.multifactorChallenge(_createApiRequest(
        AuthMultifactorChallengeOptions(
            mfaToken: mfaToken,
            types: types,
            authenticatorId: authenticatorId)));