> ## Documentation Index
> Fetch the complete documentation index at: https://translations.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MfaEmailChallenge

> Universal Login の `mfa-email-challenge` 画面をカスタマイズするために利用できる、すべてのフックとメソッドについて説明します。

`mfa-email-challenge` 画面では、MFA 検証を完了するために、メールアドレスに送信されたワンタイムコードを入力するようユーザーに求めます。

<Frame>
  <img style={{maxHeight:"400px"}} src="https://mintcdn.com/translations/sX1h_k3t8CnRaZOk/docs/images/ja-jp/cdy7uua7fh8z/2MOpok82dGPfHvpb8hy1Yc/fda2d95621af85e0ea6ff73d51d815ad/Screenshot_2025-02-20_at_13.11.50.png?fit=max&auto=format&n=sX1h_k3t8CnRaZOk&q=85&s=212a6b03f0e11ba65775afdfd8d25b2b" alt="MfaEmailChallenge" width="448" height="628" data-path="docs/images/ja-jp/cdy7uua7fh8z/2MOpok82dGPfHvpb8hy1Yc/fda2d95621af85e0ea6ff73d51d815ad/Screenshot_2025-02-20_at_13.11.50.png" />
</Frame>

<div id="import">
  ## インポート
</div>

各画面には、それぞれ独自のフックとメソッドがあります。SDK は各画面で **部分インポート** と **ルートインポート** をサポートしています。

* 部分インポートを使うと、特定のユースケースに必要なコードだけを含めることができます。
* ルートインポートを使うと、単一のバンドルからすべての画面を読み込めるため、想定されるすべての画面に対応する統一されたビルドが必要な場合に便利です。

```jsx Import Example theme={null}
// ルートインポート
import { useMfaEmailChallenge } from '@auth0/auth0-acul-react';

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

function MfaEmailChallengeScreen() {
  const { continueMethod } = useMfaEmailChallenge();
  return (
    <button onClick={() => continueMethod({ code: '123456' })}>
      Verify Code
    </button>
  );
}
```

<div id="context-hooks">
  ## コンテキストフック
</div>

`mfa-email-challenge` 画面で、Auth0 のコンテキストデータへの読み取り専用アクセスを提供する画面スコープのフックです。`@auth0/auth0-acul-react/mfa-email-challenge` からインポートします。

<ParamField body="useBranding" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/BrandingMembers">BrandingMembers</a></span>}>
  このフックは、`mfa-email-challenge` 画面に表示されるロゴ、色、テーマ設定などのブランディング構成を提供します。

  ```jsx Example theme={null}
  import { useBranding } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function CustomTheme() {
    const branding = useBranding();
  }
  ```
</ParamField>

<ParamField body="useClient" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ClientMembers">ClientMembers</a></span>}>
  このフックは、`mfa-email-challenge` 画面用の `id`、`name`、`logoUrl` など、クライアントに関連する構成を提供します。

  ```jsx Example theme={null}
  import { useClient } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function AppInfo() {
    const client = useClient();
  }
  ```
</ParamField>

<ParamField body="useOrganization" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/OrganizationMembers">OrganizationMembers</a></span>}>
  このフックは、MFA フローが組織スコープの場合に、ユーザーの組織に関する情報を提供します。組織コンテキストが存在しない場合は `null` を返します。

  ```jsx Example theme={null}
  import { useOrganization } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function OrgSelector() {
    const organization = useOrganization();
    if (!organization) {
      return <p>No organization context</p>;
    }
  }
  ```
</ParamField>

<ParamField body="usePrompt" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/PromptMembers">PromptMembers</a></span>}>
  このフックには、認証フローにおける現在の prompt に関するデータが含まれます。

  ```jsx Example theme={null}
  import { usePrompt } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function FlowInfo() {
    const prompt = usePrompt();
  }
  ```
</ParamField>

<ParamField body="useScreen" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ScreenMembersOnMfaEmailChallenge">ScreenMembersOnMfaEmailChallenge</a></span>}>
  このフックには、設定やコンテキストなど、`mfa-email-challenge` 画面に固有の詳細情報が含まれます。

  ```jsx Example theme={null}
  import { useScreen } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function ScreenDebug() {
    const screen = useScreen();
  }
  ```
</ParamField>

<ParamField body="useTenant" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/TenantMembers">TenantMembers</a></span>}>
  このフックには、`id` や関連するメタデータなど、tenant に関連するデータが含まれます。

  ```jsx Example theme={null}
  import { useTenant } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function TenantInfo() {
    const tenant = useTenant();
  }
  ```
</ParamField>

<ParamField body="useTransaction" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/TransactionMembers">TransactionMembers</a></span>}>
  このフックは、現在の MFA フローの状態など、`mfa-email-challenge` 画面に関する transaction 固有のデータを提供します。

  ```jsx Example theme={null}
  import { useTransaction } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function TransactionInfo() {
    const transaction = useTransaction();
  }
  ```
</ParamField>

<ParamField body="useUntrustedData" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/UntrustedDataMembersOnMfaEmailChallenge">UntrustedDataMembersOnMfaEmailChallenge</a></span>}>
  このフックは、URLパラメーターから事前入力された値など、画面に渡される信頼されていないデータを扱います。

  ```jsx Example theme={null}
  import { useUntrustedData } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function PrefilledForm() {
    const untrustedData = useUntrustedData();
  }
  ```
</ParamField>

<ParamField body="useUser" type={<span>() =&gt; <a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/UserMembers">UserMembers</a></span>}>
  このフックは、現在のユーザーの詳細 (`username`、`email`、利用可能な認証方法など) を提供します。

  ```jsx Example theme={null}
  import { useUser } from '@auth0/auth0-acul-react/mfa-email-challenge';
  function UserProfile() {
    const user = useUser();
  }
  ```
</ParamField>

<ParamField body="useMfaEmailChallenge" type={<a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/MfaEmailChallengeMembers">MfaEmailChallengeMembers</a>}>
  このフックは、`mfa-email-challenge` 画面で使用できるすべてのメソッドとコンテキストを返します。
</ParamField>

<div id="methods">
  ## メソッド
</div>

<ParamField body="continueMethod" type="Promise<void>">
  このメソッドは、メールMFAチャレンジを完了するために、ユーザーが入力したワンタイムコードを送信します。

  ```jsx Example theme={null}
  import { useMfaEmailChallenge } from '@auth0/auth0-acul-react/mfa-email-challenge';

  function EmailChallengeForm() {
    const { continueMethod } = useMfaEmailChallenge();
    return (
      <button onClick={() => continueMethod({ code: '123456', rememberDevice: true })}>
        Verify
      </button>
    );
  }
  ```

  **メソッドのパラメーター**

  <Expandable title="パラメーター">
    <ParamField body="options">
      [ContinuePayloadOptions](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ContinuePayloadOptions)。
    </ParamField>

    <ParamField body="code" type="string" required>
      ユーザーが入力したコード
    </ParamField>

    <ParamField body="rememberDevice?" type="boolean">
      デバイスを記憶するかどうかを示します
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="pickEmail" type="Promise<void>">
  このメソッドは、チャレンジで利用可能なメールアドレスが複数ある場合に、メール選択画面へ移動します。

  ```jsx Example theme={null}
  import { useMfaEmailChallenge } from '@auth0/auth0-acul-react/mfa-email-challenge';

  function PickEmailButton() {
    const { pickEmail } = useMfaEmailChallenge();
    return (
      <button onClick={() => pickEmail()}>
        Use a Different Email
      </button>
    );
  }
  ```
</ParamField>

<ParamField body="resendCode" type="Promise<void>">
  このメソッドは、新しいワンタイムコードをユーザーのメールアドレスに送信するようリクエストします。

  ```jsx Example theme={null}
  import { useMfaEmailChallenge } from '@auth0/auth0-acul-react/mfa-email-challenge';

  function ResendButton() {
    const { resendCode } = useMfaEmailChallenge();
    return (
      <button onClick={() => resendCode()}>
        Resend Code
      </button>
    );
  }
  ```
</ParamField>

<ParamField body="tryAnotherMethod" type="Promise<void>">
  このメソッドは、ユーザーが別の認証要素を選択できるように、MFA方式の選択画面へ移動します。

  ```jsx Example theme={null}
  import { useMfaEmailChallenge } from '@auth0/auth0-acul-react/mfa-email-challenge';

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

<div id="commonutility-hooks">
  ## 共通/ユーティリティ フック
</div>

<ParamField body={<a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useResend">useResend</a>} type="Hooks">
  このフックは、コード再送機能がある画面で、再送のクールダウン状態とロジックを管理します。
</ParamField>

<ParamField body={<a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useAuth0Themes">useAuth0Themes</a>} type="Hooks">
  このフックは、ブランディングコンテキストから取得した、フラット化された構成を含む現在のテーマオプションを返します。
</ParamField>

<ParamField body={<a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useChangeLanguage">useChangeLanguage</a>} type="Hooks">
  このフックは、現在のACUL画面で表示言語を変更するための関数を返します。
</ParamField>

<ParamField body={<a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useCurrentScreen">useCurrentScreen</a>} type="Hooks">
  このフックは、現在の画面のコンテキストとstateを取得します。
</ParamField>

<ParamField body={<a href="/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useErrors">useErrors</a>} type="Hooks">
  このフックは、画面上のサーバー、クライアント、開発者のErrorsを読み取り、管理します。
</ParamField>
