> ## 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.

# PhoneIdentifierChallenge

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

`phone-identifier-challenge` 画面は、ユーザーがワンタイムコードを入力して電話番号を確認する必要がある場合に表示されます。この画面では、ワンタイムコードの送信、再送、SMS 配信と音声通話配信の切り替え、または前の手順への戻り操作を行えます。

<Frame>
  <img style={{maxHeight:"400px"}} src="https://mintcdn.com/translations/3nS3prIggmJG9TUI/docs/images/cdy7uua7fh8z/3Cog5ZVlHphrRltcyZkq2d/c959fd72052731922ba251516403d0ac/Screenshot_2025-02-06_at_20.11.38.png?fit=max&auto=format&n=3nS3prIggmJG9TUI&q=85&s=5c6c2fa8f48f3b7d0b0d05ff0c5363d5" alt="ACUL Phone Identifier Challenge" width="369" height="494" data-path="docs/images/cdy7uua7fh8z/3Cog5ZVlHphrRltcyZkq2d/c959fd72052731922ba251516403d0ac/Screenshot_2025-02-06_at_20.11.38.png" />
</Frame>

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

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

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

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

// 部分インポート
import {
  usePhoneIdentifierChallenge,
  // コンテキストフック
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  // 共通フック
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  useResend,
  // ユーティリティフック
  useChangeLanguage,
  // メソッド
  submitPhoneChallenge,
  resendCode,
  returnToPrevious,
  switchToText,
  switchToVoice,
} from '@auth0/auth0-acul-react/phone-identifier-challenge';

function PhoneIdentifierChallengeScreen() {
  const { submitPhoneChallenge } = usePhoneIdentifierChallenge();
  return (
    <button onClick={() => submitPhoneChallenge({ code: '123456' })}>Verify</button>
  );
}
```

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<ParamField body="useTransaction" type={<span>() =&gt; <a href="/ja/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/TransactionMembers">TransactionMembers</a></span>}>
  このフックは、アクティブな接続や現在のフロー状態など、`phone-identifier-challenge` 画面に関するトランザクション固有のデータを提供します。

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

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

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

<ParamField body="useUser" type={<span>() =&gt; <a href="/ja/docs/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/phone-identifier-challenge';
  function UserProfile() {
    const user = useUser();
  }
  ```
</ParamField>

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

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

<ParamField body="submitPhoneChallenge" type="Promise<void>">
  このメソッドは、ユーザーが入力したワンタイムコードを送信して電話番号を確認し、認証フローの次のステップに進みます。

  ```jsx Example theme={null}
  import { usePhoneIdentifierChallenge } from '@auth0/auth0-acul-react/phone-identifier-challenge';

  function VerifyButton() {
    const { submitPhoneChallenge } = usePhoneIdentifierChallenge();
    return (
      <button onClick={() => submitPhoneChallenge({ code: '123456' })}>
        Verify
      </button>
    );
  }
  ```

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

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

    <ParamField body="code" type="string" required>
      ユーザーの電話番号に送信された確認コード。
    </ParamField>

    <ParamField body="captcha?" type="string">
      このテナントで CAPTCHA が有効になっている場合の、CAPTCHA レスポンストークン。
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="resendCode" type="Promise<void>">
  このメソッドは、ユーザーの電話番号にワンタイムコードを再送信します。

  ```jsx Example theme={null}
  import { usePhoneIdentifierChallenge } from '@auth0/auth0-acul-react/phone-identifier-challenge';

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

<ParamField body="returnToPrevious" type="Promise<void>">
  このメソッドは、ユーザーを認証フローの前のステップに戻します。

  ```jsx Example theme={null}
  import { usePhoneIdentifierChallenge } from '@auth0/auth0-acul-react/phone-identifier-challenge';

  function BackButton() {
    const { returnToPrevious } = usePhoneIdentifierChallenge();
    return (
      <button onClick={() => returnToPrevious()}>
        Back
      </button>
    );
  }
  ```
</ParamField>

<ParamField body="switchToText" type="Promise<void>">
  このメソッドは、電話番号確認の送信方法を SMS テキストメッセージに切り替えます。

  ```jsx Example theme={null}
  import { usePhoneIdentifierChallenge } from '@auth0/auth0-acul-react/phone-identifier-challenge';

  function SwitchToSmsButton() {
    const { switchToText } = usePhoneIdentifierChallenge();
    return (
      <button onClick={() => switchToText()}>
        Send via SMS
      </button>
    );
  }
  ```
</ParamField>

<ParamField body="switchToVoice" type="Promise<void>">
  このメソッドは、電話番号確認の送信方法を音声通話に切り替えます。

  ```jsx Example theme={null}
  import { usePhoneIdentifierChallenge } from '@auth0/auth0-acul-react/phone-identifier-challenge';

  function SwitchToVoiceButton() {
    const { switchToVoice } = usePhoneIdentifierChallenge();
    return (
      <button onClick={() => switchToVoice()}>
        Send via Voice Call
      </button>
    );
  }
  ```
</ParamField>

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

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

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

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

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

<ParamField body={<a href="/ja/docs/libraries/acul/react-sdk/API-Reference/Hooks/useResend">useResend</a>} type="Hooks">
  このフックは、`resendCode` メソッドの再送クールダウンの状態とタイマーを管理します。
</ParamField>
