Multi-Factor Authentication Phone screen classes

MFA Phone Challenge screen class

The MFA Phone Challenge screen class provides methods associated with the mfa-phone-challenge screen. This screen is displayed when the user needs to receive a code to verity their identity.

Import and instantiate the MFA Phone Challenge screen class:

import MfaPhoneChallenge from '@auth0/auth0-acul-js/mfa-phone-challenge';
const mfaPhoneChallenge = new MfaPhoneChallenge();

// You can access screen data like the phone number
const phoneNumber = mfaPhoneChallenge.screen.data?.phoneNumber;
console.log('Phone number for challenge:', phoneNumber);

// Access transaction details like errors
const errors = mfaPhoneChallenge.transaction.errors;
if (errors) {
  console.error('Transaction errors:', errors);
}

Was this helpful?

/

Properties

The MFA Phone Challenge screen class properties are:

interface branding {
  settings: null | BrandingSettings;
  themes: null | BrandingThemes;
}

interface BrandingSettings {
  colors?: {
    pageBackground?: string | {
      angleDeg: number;
      end: string;
      start: string;
      type: string;
    };
    primary?: string;
  };
  faviconUrl?: string;
  font?: {url: string;};
  logoUrl?: string;
}

interface BrandingThemes {
  default: {
    borders: Record<string, string | number | boolean>;
    colors: Record<string, string>;
    displayName: string;
    fonts: Record<string, string | boolean | object>;
    pageBackground: Record<string, string>;
    widget: Record<string, string | number>;
  };
}

Was this helpful?

/

Methods

The MFA Phone Challenge screen class methods are:

continue( options ?)

This method submits the user's choice of receiving the MFA code via SMS or voice call. It uses the phone number from the class screen property.

const mfaPhoneChallenge = new MfaPhoneChallenge();

// Request code via SMS
await mfaPhoneChallenge.continue({ type: 'sms' });

// Request code via Voice Call
await mfaPhoneChallenge.continue({ type: 'voice' });

Was this helpful?

/

Parameter                  Type Required Description
type sms | voice Yes define the method to receive the verification code.

pickPhone( options ?)

This method redirects the user to a phone selection screen.

const mfaPhoneChallenge = new MfaPhoneChallenge();
await mfaPhoneChallenge.pickPhone();

Was this helpful?

/

tryAnotherMethod( options ?)

This method redirects the user to the authenticator selection screen.

const mfaPhoneChallenge = new MfaPhoneChallenge();
await mfaPhoneChallenge.tryAnotherMethod();

Was this helpful?

/

MFA Phone Enrollment screen class

The Device Code Confirmation screen class provides methods associated with the mfa-phone-enrollment screen. This screen is displayed when a user needs to confirm the device code.

Import and instantiate the MFA Phone Enrollment screen class:

import MfaPhoneEnrollment from '@auth0/auth0-acul-js/mfa-phone-enrollment';
const mfaPhoneEnrollment = new MfaPhoneEnrollment();

// Call the continueEnrollment method with a phone number and type
mfaPhoneEnrollment.continueEnrollment({
    phone: "1234567890",
    type: "sms" // or "voice"
});

Was this helpful?

/

Properties

The MFA Phone Enrollment screen class properties are:

interface branding {
  settings: null | BrandingSettings;
  themes: null | BrandingThemes;
}

interface BrandingSettings {
  colors?: {
    pageBackground?: string | {
      angleDeg: number;
      end: string;
      start: string;
      type: string;
    };
    primary?: string;
  };
  faviconUrl?: string;
  font?: {url: string;};
  logoUrl?: string;
}

interface BrandingThemes {
  default: {
    borders: Record<string, string | number | boolean>;
    colors: Record<string, string>;
    displayName: string;
    fonts: Record<string, string | boolean | object>;
    pageBackground: Record<string, string>;
    widget: Record<string, string | number>;
  };
}

Was this helpful?

/

Methods

The MFA Phone Enrollment screen class methods are:

continueEnrollment( options ?)

This method continues the enrollment process with the provided phone number and selected type SMS or voice.

const mfaPhoneEnrollment = new MfaPhoneEnrollment();

// Call the continueEnrollment method with a phone number and type
mfaPhoneEnrollment.continueEnrollment({
  phone: "1234567890",
  type: "sms" // or "voice"
});

Was this helpful?

/

Parameter                  Type Required Description
phone string Yes The user's phone number.
type sms | voice Yes define the method to receive the verification code.

pickCountryCode( options ?)

This method allows users to pick their country code.

const mfaPhoneEnrollment = new MfaPhoneEnrollment();

// Call the pickCountryCode method
mfaPhoneEnrollment.pickCountryCode();

Was this helpful?

/

tryAnotherMethod( options ?)

This method asks users to try another MFA method.

const mfaPhoneEnrollment = new MfaPhoneEnrollment();

// Call the tryAnotherMethod
mfaPhoneEnrollment.tryAnotherMethod();

Was this helpful?

/