メインコンテンツへスキップ
mfa-phone-enrollment 画面では、ユーザーは電話番号を入力し、受信方法を選択して、SMS または音声による MFA 用の電話番号を登録できます。
MfaPhoneEnrollment

インポート

各画面には、それぞれ固有のフックとメソッドがあります。SDK は、各画面について部分インポートルートインポートをサポートしています。
  • 部分インポートを使用すると、特定のユースケースに必要なコードのみを含めることができます。
  • ルートインポートを使用すると、単一のバンドルからすべての画面を読み込めます。これは、考えられるすべての画面に対応する単一のビルドを使用したい場合に便利です。
Import Example
// ルートインポート
import { useMfaPhoneEnrollment } from '@auth0/auth0-acul-react';

// 部分インポート
import {
  useMfaPhoneEnrollment,
  // コンテキストフック
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  // 共通フック
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  // ユーティリティフック
  useChangeLanguage,
  // メソッド
  continueEnrollment,
  pickCountryCode,
  tryAnotherMethod,
} from "@auth0/auth0-acul-react/mfa-phone-enrollment";

function MfaPhoneEnrollmentScreen() {
  const { continueEnrollment } = useMfaPhoneEnrollment();
  return (
    <button onClick={() => continueEnrollment({ phone: '+15551234567', type: 'sms' })}>
      Enroll Phone
    </button>
  );
}

コンテキスト Hooks

mfa-phone-enrollment 画面で Auth0 のコンテキストデータに読み取り専用でアクセスできる、画面スコープの フック です。@auth0/auth0-acul-react/mfa-phone-enrollment からインポートします。
useBranding
この フック は、mfa-phone-enrollment 画面に表示されるロゴ、色、テーマ設定などのブランディング設定を提供します。
Example
import { useBranding } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function CustomTheme() {
  const branding = useBranding();
}
useClient
この フック は、idnamelogoUrl など、mfa-phone-enrollment 画面のクライアント関連設定を提供します。
Example
import { useClient } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function AppInfo() {
  const client = useClient();
}
useOrganization
この フック は、MFA フローが組織スコープの場合に、ユーザーの組織に関する情報を提供します。組織コンテキストが存在しない場合は null を返します。
Example
import { useOrganization } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function OrgSelector() {
  const organization = useOrganization();
  if (!organization) {
    return <p>No organization context</p>;
  }
}
usePrompt
この フック は、認証フロー内の現在のプロンプトに関するデータを提供します。
Example
import { usePrompt } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function FlowInfo() {
  const prompt = usePrompt();
}
useScreen
この フック は、設定やコンテキストなど、mfa-phone-enrollment 画面に固有の詳細を提供します。
Example
import { useScreen } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function ScreenDebug() {
  const screen = useScreen();
}
useTenant
この フック は、id や関連メタデータなど、テナントに関連するデータを提供します。
Example
import { useTenant } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function TenantInfo() {
  const tenant = useTenant();
}
useTransaction
この フック は、現在の MFA フローの状態など、mfa-phone-enrollment 画面のトランザクション固有のデータを提供します。
Example
import { useTransaction } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function TransactionInfo() {
  const transaction = useTransaction();
}
useUntrustedData
この フック は、URL パラメーターから事前入力された値など、画面に渡される信頼できないデータを提供します。
Example
import { useUntrustedData } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function PrefilledForm() {
  const untrustedData = useUntrustedData();
}
useUser
このフックは、usernameemail、利用可能な認証方法など、現在のユーザーの詳細を返します。
Example
import { useUser } from '@auth0/auth0-acul-react/mfa-phone-enrollment';
function UserProfile() {
  const user = useUser();
}
useMfaPhoneEnrollment
このフックは、mfa-phone-enrollment 画面で利用可能なすべてのメソッドとコンテキストを返します。

メソッド

continueEnrollment
Promise<void>
このメソッドは、ユーザーの電話番号と選択した送信方法を送信して、MFA 用の電話番号を登録します。
Example
import { useMfaPhoneEnrollment } from '@auth0/auth0-acul-react/mfa-phone-enrollment';

function PhoneEnrollmentForm() {
  const { continueEnrollment } = useMfaPhoneEnrollment();
  return (
    <button onClick={() => continueEnrollment({ phone: '+15551234567', type: 'sms' })}>
      Enroll Phone
    </button>
  );
}
メソッドパラメーター
pickCountryCode
Promise<void>
このメソッドは国番号の選択画面に移動し、ユーザーが自分の電話番号の国番号を選択できるようにします。
Example
import { useMfaPhoneEnrollment } from '@auth0/auth0-acul-react/mfa-phone-enrollment';

function PickCountryCodeButton() {
  const { pickCountryCode } = useMfaPhoneEnrollment();
  return (
    <button onClick={() => pickCountryCode()}>
      Select Country Code
    </button>
  );
}
tryAnotherMethod
Promise<void>
このメソッドは MFA 方法の選択画面に移動し、ユーザーが別の認証要素を選択できるようにします。
Example
import { useMfaPhoneEnrollment } from '@auth0/auth0-acul-react/mfa-phone-enrollment';

function TryAnotherMethodButton() {
  const { tryAnotherMethod } = useMfaPhoneEnrollment();
  return (
    <button onClick={() => tryAnotherMethod()}>
      Try Another Method
    </button>
  );
}

共通/ユーティリティ フック

このフックは、ブランディングコンテキストからフラット化された構成を含む現在のテーマオプションを取得します。
このフックは、現在の ACUL 画面の表示言語を変更する関数を返します。
このフックは、現在の画面のコンテキストと状態を取得します。
このフックは、画面上のサーバー、クライアント、開発者のエラーを参照および管理します。