メインコンテンツへスキップ
organization-selection 画面は、認証フローを続行するためにユーザーが組織名を入力する必要がある場合に表示されます。ユーザーは組織名を入力して続行できます。
ACUL 組織の選択

インポート

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

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

function OrganizationSelectionScreen() {
  const { continueWithOrganizationName } = useOrganizationSelection();
  return (
    <button onClick={() => continueWithOrganizationName({ organizationName: 'my-org' })}>Continue</button>
  );
}

コンテキストフック

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

メソッド

continueWithOrganizationName
Promise<void>
このメソッドは、ユーザーが入力した組織名を送信し、認証フローを続行します。
Example
import { useOrganizationSelection } from '@auth0/auth0-acul-react/organization-selection';

function ContinueButton() {
  const { continueWithOrganizationName } = useOrganizationSelection();
  return (
    <button onClick={() => continueWithOrganizationName({ organizationName: 'my-org' })}>
      Continue
    </button>
  );
}
メソッド パラメーター

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

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