メインコンテンツへスキップ
organization-picker 画面は、ユーザーがログインする組織を選択する必要がある場合に表示されます。ユーザーは組織を選択することも、この選択手順をスキップすることもできます。
ACUL 組織ピッカー

インポート

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

// 部分インポート
import {
  useOrganizationPicker,
  // コンテキストフック
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  // 共通フック
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  // ユーティリティフック
  useChangeLanguage,
  // メソッド
  selectOrganization,
  skipOrganizationSelection,
} from '@auth0/auth0-acul-react/organization-picker';

function OrganizationPickerScreen() {
  const { selectOrganization } = useOrganizationPicker();
  return (
    <button onClick={() => selectOrganization({ organization: 'my-org', state: 'abc123' })}>Select</button>
  );
}

コンテキストフック

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

メソッド

selectOrganization
Promise<void>
このメソッドは、ユーザーが選択した組織を送信し、認証フローを次のステップに進めます。
Example
import { useOrganizationPicker } from '@auth0/auth0-acul-react/organization-picker';

function SelectButton() {
  const { selectOrganization } = useOrganizationPicker();
  return (
    <button onClick={() => selectOrganization({ organization: 'my-org', state: 'abc123' })}>
      Select Organization
    </button>
  );
}
メソッド パラメーター
skipOrganizationSelection
Promise<void>
このメソッドを使用すると、ユーザーは組織の選択ステップをスキップし、組織を選択せずに認証フローを次のステップに進めることができます。
Example
import { useOrganizationPicker } from '@auth0/auth0-acul-react/organization-picker';

function SkipButton() {
  const { skipOrganizationSelection } = useOrganizationPicker();
  return (
    <button onClick={() => skipOrganizationSelection()}>
      Skip
    </button>
  );
}

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

このフックは、ブランディングコンテキストのフラット化された設定を含む現在のテーマオプションを取得します。
このフックは、現在の ACUL 画面の表示言語を変更する関数を返します。
このフックは、現在の画面のコンテキストと state を取得します。
このフックは、画面上のサーバー、クライアント、開発者のエラーを読み取り、管理します。