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

# LoginId

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

`login-id` 画面では、識別子を先に入力する認証フローの最初のステップとして、ユーザーの識別子を収集します。テナントによって、この識別子にはメールアドレス、電話番号、またはユーザー名を使用できます。また、パスキーによるログインやフェデレーテッド ID プロバイダー、Google One Tap にも対応しています。

![](https://mintlify.s3.us-west-1.amazonaws.com/docs-dev/images/cdy7uua7fh8z/1nvMFmxC5ODCW2q7cByHv8/657d87ba1c2eb11316e6b0ef93737c99/LoginIDACUL.png)

## インポート

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

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

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

// 部分インポート
import {
  useLoginId,
  // コンテキストフック
  useUser,
  useTenant,
  useBranding,
  useClient,
  useCountryCodes,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  useExperiment,
  // 共通フック
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  // ユーティリティフック
  useLoginIdentifiers,
  useChangeLanguage,
  usePasskeyAutofill,
  // メソッド
  login,
  federatedLogin,
  googleOneTap,
  passkeyLogin,
  pickCountryCode,
} from '@auth0/auth0-acul-react/login-id';

function LoginIdForm() {
  const { login } = useLoginId();
  return (
    <button onClick={() => login({ username: 'user@example.com' })}>
      Continue
    </button>
  );
}
```

## Context Hooks

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

**useBranding** `() => [BrandingMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/BrandingMembers)`

このフックは、`login-id` 画面に表示されるロゴ、色、テーマ設定などのブランディング設定を提供します。

```jsx Example theme={null}
import { useBranding } from '@auth0/auth0-acul-react/login-id';
function CustomTheme() {
  const branding = useBranding();
}
```

**useClient** `() => [ClientMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ClientMembers)`

このフックは、`login-id` 画面の `id`、`name`、`logoUrl` など、クライアントに関する設定を提供します。

```jsx Example theme={null}
import { useClient } from '@auth0/auth0-acul-react/login-id';
function AppInfo() {
  const client = useClient();
}
```

**useCountryCodes** `() => [CountryCodesMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/CountryCodesMembers)`

このフックは、`login-id` 画面で利用可能な電話番号の国コードと推奨されるデフォルトを提供します。

```jsx Example theme={null}
import { useCountryCodes } from '@auth0/auth0-acul-react/login-id';
function CountryPicker() {
  const countryCodes = useCountryCodes();
  const available = countryCodes?.available;
}
```

**useExperiment** `() => [ExperimentMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ExperimentMembers)`

このフックは、`login-id` 画面で有効な [Experiment Center](/docs/docs/ja-jp/customize/experiment-center) の experiment を提供します。有効な experiment がない場合 (または画面が `context_configuration` でオプトインしていない場合) は `null` を返します。

```jsx Example theme={null}
import { useExperiment } from '@auth0/auth0-acul-react/login-id';
function ExperimentBranch() {
  const experiment = useExperiment();
  if (!experiment) return null;
  return experiment.isControl ? <ControlUI /> : <TreatmentUI />;
}
```

**useOrganization** `() => [OrganizationMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/OrganizationMembers)`

このフックは、ログインが組織スコープの場合に、ユーザーの組織に関する情報を提供します。組織コンテキストが存在しない場合は `null` を返します。

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

**usePrompt** `() => [PromptMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/PromptMembers)`

このフックには、認証フロー内の現在のプロンプトに関するデータが含まれています。

```jsx Example theme={null}
import { usePrompt } from '@auth0/auth0-acul-react/login-id';
function FlowInfo() {
  const prompt = usePrompt();
}
```

**useScreen** `() => [ScreenMembersOnLoginId](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/ScreenMembersOnLoginId)`

このフックには、設定やコンテキストを含む、`login-id` 画面固有の詳細情報が含まれています。

```jsx Example theme={null}
import { useScreen } from '@auth0/auth0-acul-react/login-id';
function ScreenDebug() {
  const screen = useScreen();
}
```

**useTenant** `() => [TenantMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/TenantMembers)`

このフックには、`id` や関連するメタデータなど、テナントに関するデータが含まれています。

```jsx Example theme={null}
import { useTenant } from '@auth0/auth0-acul-react/login-id';
function TenantInfo() {
  const tenant = useTenant();
}
```

**useTransaction** `() => [TransactionMembersOnLoginId](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/TransactionMembersOnLoginId)`

このフックは、アクティブな接続、利用可能なログイン方法、現在のフローの状態など、`login-id` 画面の取引に固有のデータを提供します。

```jsx Example theme={null}
import { useTransaction } from '@auth0/auth0-acul-react/login-id';
function TransactionInfo() {
  const transaction = useTransaction();
}
```

**useUntrustedData** `() => [UntrustedDataMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/UntrustedDataMembers)`

このフックは、URL パラメーターで事前入力された識別子など、画面に渡される信頼できないデータを処理します。

```jsx Example theme={null}
import { useUntrustedData } from '@auth0/auth0-acul-react/login-id';
function PrefilledForm() {
  const untrustedData = useUntrustedData();
}
```

**useUser** `() => [UserMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/UserMembers)`

このフックは、`username`、`email`、利用可能な認証方法など、現在のユーザーに関する情報を提供します。

```jsx Example theme={null}
import { useUser } from '@auth0/auth0-acul-react/login-id';
function UserProfile() {
  const user = useUser();
}
```

**useLoginId** `[LoginIdMembers](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/LoginIdMembers)`

このフックは、`login-id` 画面で使用できるすべてのメソッドとコンテキストを返します。

## メソッド

**googleOneTap** `Promise\<void\>`

このメソッドは、Google One Tap 認証情報を使用してユーザーを認証し、別のログインページにリダイレクトすることなくワンクリックでサインインできるようにします。

```jsx Example theme={null}
import { useLoginId } from '@auth0/auth0-acul-react/login-id';

function GoogleOneTapHandler({ credential }) {
  const { googleOneTap } = useLoginId();
  return googleOneTap({ one_tap_credential: credential });
}
```

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

**パラメーター**

**one\_tap\_credential** `string` *required*

Google Identity Services のプロンプトから返される Google One Tap 認証情報トークン。

**federatedLogin** `Promise\<void\>`

このメソッドは、認証のためにユーザーを [Social](/docs/docs/ja-jp/authenticate/identity-providers/social-identity-providers) または [Enterprise Identity Provider](/docs/docs/ja-jp/authenticate/identity-providers/enterprise-identity-providers) (IdP) にリダイレクトします。

```jsx Example theme={null}
import { useLoginId } from '@auth0/auth0-acul-react/login-id';

function SocialButton() {
  const { federatedLogin } = useLoginId();
  return (
    <button onClick={() => federatedLogin({ connection: 'google-oauth2' })}>
      Sign in with Google
    </button>
  );
}
```

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

**パラメーター**

**connection** `string` *required*

Social または Enterprise Identity Provider の接続名。

**\[`key`: `string`]** `"string" | "number" | "boolean" | "undefined"`

`ulp-` で始まる追加のカスタムフィールド (例: `'ulp-custom-field'`) 。

**login** `Promise\<void\>`

このメソッドは、認証フローの次のステップに進むため、ユーザーの識別子を送信します。

```jsx Example theme={null}
import { useLoginId } from '@auth0/auth0-acul-react/login-id';

function LoginIdForm() {
  const { login } = useLoginId();
  return (
    <button onClick={() => login({ username: 'user@example.com' })}>
      Continue
    </button>
  );
}
```

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

**パラメーター**

**options**

[LoginOptions](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/LoginOptions)。

**identifier?** `string`

ユーザーの識別子。`identifierType` に応じてメールアドレス、ユーザー名、または電話番号を指定します。これまたは `username` を指定してください。両方が指定された場合は、`identifier` が優先されます。

**username?** `string`

元の表記のユーザー識別子。これまたは `identifier` を指定してください。

**identifierType?** `[IdentifierType](/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/type-aliases/IdentifierType)`

`identifier` (または `username`) の内容を指定します。通常は `screen.data.activeIdentifierType` から読み取ります。型を指定せずに識別子を送信する場合は省略します。

**phoneCountryCode?** `string`

電話番号識別子の ISO 3166-1 alpha-2 国コード。`countryCodes.available` 内の `code` から指定します。`identifierType` が `phone` の場合は必須です。国内番号を渡してください。ダイヤルコードはサーバー側で先頭に付加されます。

**captcha?** `string`

テナントでボット検出が有効になっている場合に必要な CAPTCHA 値。

**\[`key`: `string`]** `"string" | "number" | "boolean" | "undefined"`

`ulp-` で始まる追加のカスタムフィールド (例: `'ulp-custom-field'`) 。

**passkeyLogin** `Promise\<void\>`

このメソッドは、パスキーを使用したパスワードレス認証を開始します。

```jsx Example theme={null}
import { useLoginId } from '@auth0/auth0-acul-react/login-id';

function PasskeyButton() {
  const { passkeyLogin } = useLoginId();
  return (
    <button onClick={() => passkeyLogin()}>
      Sign in with Passkey
    </button>
  );
}
```

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

**パラメーター**

**options**

[CustomOptions](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Types/interfaces/CustomOptions)。

**\[`key`: `string`]** `"string" | "number" | "boolean" | "undefined"`

`ulp-` で始まる追加のカスタムフィールド (例: `'ulp-custom-field'`) 。

**pickCountryCode** `Promise\<void\>`

このメソッドは、電話ベースのログインフローで国コードの選択画面に移動します。

```jsx Example theme={null}
import { useLoginId } from '@auth0/auth0-acul-react/login-id';

function PhoneLogin() {
  const { pickCountryCode } = useLoginId();
  return (
    <button onClick={() => pickCountryCode()}>
      Select Country Code
    </button>
  );
}
```

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

**[useAuth0Themes](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useAuth0Themes)** `Hooks`

このフックは、ブランディングコンテキストからフラット化された設定を含む現在のテーマオプションを取得します。

**[useChangeLanguage](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useChangeLanguage)** `Hooks`

このフックは、現在の ACUL 画面の表示言語を変更するための関数を返します。

**[useCurrentScreen](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useCurrentScreen)** `Hooks`

このフックは、現在の画面のコンテキストと状態を取得します。

**[useErrors](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useErrors)** `Hooks`

このフックは、画面上のサーバー、クライアント、開発者エラーを読み取り、管理します。

**[useLoginIdentifiers](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/useLoginIdentifiers)** `Hooks`

このフックは、現在のフローで有効な識別子タイプ (`email`、`phone`、`username`) の一覧を返します。

**[usePasskeyAutofill](/docs/docs/ja-jp/libraries/acul/react-sdk/API-Reference/Hooks/usePasskeyAutofill)** `Hooks`

このフックは、シームレスなパスワードレスのログイン体験を実現するために、入力フィールドでのパスキーの自動入力を有効にします。
