メインコンテンツへスキップ
mfa-sms-challenge 画面では、MFA 検証を完了するために、SMS で電話番号に送信されたワンタイムコードを入力するようユーザーに求めます。
MfaSmsChallenge

インポート

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

// 部分インポート
import {
  useMfaSmsChallenge,
  // コンテキストフック
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  // 共通フック
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  // ユーティリティフック
  useChangeLanguage,
  useResend,
  // メソッド
  continueMfaSmsChallenge,
  getACall,
  pickSms,
  resendCode,
  tryAnotherMethod,
} from "@auth0/auth0-acul-react/mfa-sms-challenge";

function MfaSmsChallengeScreen() {
  const { continueMfaSmsChallenge } = useMfaSmsChallenge();
  return (
    <button onClick={() => continueMfaSmsChallenge({ code: '123456' })}>
      Verify Code
    </button>
  );
}

コンテキストHooks

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

メソッド

continueMfaSmsChallenge
Promise<void>
このメソッドは、SMS で送信されたワンタイムコードを送信して MFA チャレンジを完了します。
Example
import { useMfaSmsChallenge } from '@auth0/auth0-acul-react/mfa-sms-challenge';

function VerifyCodeForm() {
  const { continueMfaSmsChallenge } = useMfaSmsChallenge();
  return (
    <button onClick={() => continueMfaSmsChallenge({ code: '123456' })}>
      Verify Code
    </button>
  );
}
メソッドパラメーター
getACall
Promise<void>
このメソッドは、MFA チャレンジを SMS から音声通話に切り替えます。
Example
import { useMfaSmsChallenge } from '@auth0/auth0-acul-react/mfa-sms-challenge';

function GetACallButton() {
  const { getACall } = useMfaSmsChallenge();
  return (
    <button onClick={() => getACall()}>
      Get a Call Instead
    </button>
  );
}
pickSms
Promise<void>
このメソッドは、SMS の電話番号選択画面に移動します。
Example
import { useMfaSmsChallenge } from '@auth0/auth0-acul-react/mfa-sms-challenge';

function PickSmsButton() {
  const { pickSms } = useMfaSmsChallenge();
  return (
    <button onClick={() => pickSms()}>
      Use a Different Phone Number
    </button>
  );
}
resendCode
Promise<void>
このメソッドは、SMS のワンタイムコードをユーザーの電話番号に再送信します。
Example
import { useMfaSmsChallenge } from '@auth0/auth0-acul-react/mfa-sms-challenge';

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

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

共通/ユーティリティHooks

このフックは、code を再送できる画面の再送クールダウン状態とロジックを管理します。
このフックは、ブランディングコンテキストからフラット化された設定を含む現在のテーマオプションを取得します。
このフックは、現在の ACUL 画面の表示言語を変更するための関数を返します。
このフックは、現在の画面のコンテキストと状態を取得します。
このフックは、画面上のサーバー、クライアント、開発者の各エラーを取得して管理します。