メインコンテンツへスキップ
mfa-phone-enrollment 画面の機能を実装するクラスです。 この画面では、ユーザーが電話番号を用いた 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('国コードの選択が完了しました。');
 } catch (error) {
   console.error('国コード選択時のエラー:', 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',
    });
  }

  /**
指定された電話番号とタイプ(SMSまたは音声)で登録プロセスを続行します。
@param payload 電話番号とタイプ(SMSまたは音声)。
@example

コンストラクター

MfaPhoneEnrollment
Constructor
MfaPhoneEnrollment 画面のインスタンスを作成します。

プロパティ

branding
client
organization
prompt
screen
tenant
transaction
untrustedData
user
screenIdentifier
string

メソッド

continueEnrollment
Promise<void>
指定された電話番号とタイプ(SMS または音声)で登録プロセスを継続します。
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', // または 'voice'
   });
   console.log('Phone enrollment continued successfully.');
 } catch (error) {
   console.error('Error continuing phone enrollment:', error);
 }
}
getErrors
コンテキストからトランザクションのエラー配列を取得します。存在しない場合は空の配列を返します。トランザクションコンテキストから取得されるエラーオブジェクトの配列です。
pickCountryCode
Promise<void>
国コード選択画面に遷移します。
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>
ユーザーが別の MFA(多要素認証)手段を試せるようにします。
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);
 }
}