Skip to main content
Class implementing the mfa-phone-enrollment screen functionality. This screen allows users to enroll using a phone number for MFA.
Example
import MfaPhoneEnrollment from '@auth0/auth0-acul-js/mfa-phone-enrollment';
const mfaPhoneEnrollmentManager = new MfaPhoneEnrollment();
async function handlePickCountryCode() {
 try {
   await mfaPhoneEnrollmentManager.pickCountryCode();
   console.log('Country code selection successful.');
 } catch (error) {
   console.error('Error selecting country code:', error);
 }
}
/
  async pickCountryCode(payload?: CustomOptions): Promise<void> {
    const options = {
      state: this.transaction.state,
      telemetry: [MfaPhoneEnrollment.screenIdentifier, 'pickCountryCode'],
    };
    await new FormHandler(options).submitData<CustomOptions>({
      ...payload,
      action: 'pick-country-code',
    });
  }

  /**
Continues the enrollment process with the provided phone number and type (SMS or voice).
@param payload The phone number and type (SMS or voice).
@example

Constructors

MfaPhoneEnrollment
Constructor
Creates an instance of the MfaPhoneEnrollment screen.

Properties

branding
client
organization
prompt
screen
tenant
transaction
untrustedData
user
screenIdentifier
string

Methods

continueEnrollment
Promise<void>
Continues the enrollment process with the provided phone number and type (SMS or voice).
Example
import MfaPhoneEnrollment from '@auth0/auth0-acul-js/mfa-phone-enrollment';
const mfaPhoneEnrollmentManager = new MfaPhoneEnrollment();
async function handleContinueEnrollment() {
 try {
   await mfaPhoneEnrollmentManager.continueEnrollment({
     phone: '+1234567890',
     type: 'sms', // or 'voice'
   });
   console.log('Phone enrollment continued successfully.');
 } catch (error) {
   console.error('Error continuing phone enrollment:', error);
 }
}
getErrors
Retrieves the array of transaction errors from the context, or an empty array if none exist.An array of error objects from the transaction context.
pickCountryCode
Promise<void>
Navigates to the country code selection screen.
Example
import MfaPhoneEnrollment from '@auth0/auth0-acul-js/mfa-phone-enrollment';
const mfaPhoneEnrollmentManager = new MfaPhoneEnrollment();
async function handlePickCountryCode() {
 try {
   await mfaPhoneEnrollmentManager.pickCountryCode();
   console.log('Country code selection successful.');
 } catch (error) {
   console.error('Error selecting country code:', error);
 }
}

tryAnotherMethod
Promise<void>
Allows the user to try another MFA method.
Example
import MfaPhoneEnrollment from '@auth0/auth0-acul-js/mfa-phone-enrollment';
const mfaPhoneEnrollmentManager = new MfaPhoneEnrollment();
async function handleTryAnotherMethod() {
 try {
   await mfaPhoneEnrollmentManager.tryAnotherMethod(); 
   console.log('Switched to another authentication method.');
  } catch (error) { 
 console.error('Error switching authenticator method:', error);
 }
}