login-email-verification 画面では、ログインフロー中に本人確認を行うため、メールアドレスに送信された確認コードを入力するようユーザーに求めます。
各画面には、それぞれ固有の Hooks とメソッドがあります。SDK は、各画面で部分インポートとルートインポートをサポートしています。
- 部分インポートを使用すると、特定のユースケースに必要なコードだけを含めることができます。
- ルートインポートを使用すると、単一のバンドルからすべての画面を読み込めます。これは、想定されるあらゆる画面に対応する単一のビルドが必要な場合に便利です。
// ルートインポート
import { useLoginEmailVerification } from '@auth0/auth0-acul-react';
// 部分インポート
import {
useLoginEmailVerification,
// コンテキストフック
useUser,
useTenant,
useBranding,
useClient,
useOrganization,
usePrompt,
useScreen,
useTransaction,
useUntrustedData,
// 共通フック
useCurrentScreen,
useAuth0Themes,
useErrors,
// ユーティリティフック
useChangeLanguage,
useResend,
// メソッド
continueWithCode,
resendCode,
} from '@auth0/auth0-acul-react/login-email-verification';
function LoginEmailVerificationForm() {
const { continueWithCode } = useLoginEmailVerification();
return (
<button onClick={() => continueWithCode({ code: '123456' })}>
Verify
</button>
);
}
login-email-verification 画面で、Auth0 のコンテキストデータへの読み取り専用アクセスを提供する画面スコープのフックです。@auth0/auth0-acul-react/login-email-verification からインポートします。
このフックは、login-email-verification 画面に表示されるロゴ、色、テーマ設定などのブランディング構成を提供します。import { useBranding } from '@auth0/auth0-acul-react/login-email-verification';
function CustomTheme() {
const branding = useBranding();
}
このフックは、login-email-verification 画面の id、name、logoUrl など、クライアント関連の構成を提供します。import { useClient } from '@auth0/auth0-acul-react/login-email-verification';
function AppInfo() {
const client = useClient();
}
このフックは、ログインが組織スコープの場合に、ユーザーの組織に関する情報を提供します。組織コンテキストが存在しない場合は null を返します。import { useOrganization } from '@auth0/auth0-acul-react/login-email-verification';
function OrgSelector() {
const organization = useOrganization();
if (!organization) {
return <p>No organization context</p>;
}
}
このフックには、認証フローにおける現在のプロンプトに関するデータが含まれます。import { usePrompt } from '@auth0/auth0-acul-react/login-email-verification';
function FlowInfo() {
const prompt = usePrompt();
}
このフックには、設定やコンテキストを含む login-email-verification 画面固有の詳細が含まれます。import { useScreen } from '@auth0/auth0-acul-react/login-email-verification';
function ScreenDebug() {
const screen = useScreen();
}
このフックには、id や関連メタデータなど、テナントに関するデータが含まれます。import { useTenant } from '@auth0/auth0-acul-react/login-email-verification';
function TenantInfo() {
const tenant = useTenant();
}
このフックは、アクティブな接続や現在のフロー状態など、login-email-verification 画面に関するトランザクション固有のデータを提供します。import { useTransaction } from '@auth0/auth0-acul-react/login-email-verification';
function TransactionInfo() {
const transaction = useTransaction();
}
このフックは、URL クエリ文字列のパラメータなど、画面に渡される信頼できないデータを扱います。import { useUntrustedData } from '@auth0/auth0-acul-react/login-email-verification';
function PrefilledForm() {
const untrustedData = useUntrustedData();
}
このフックは、アクティブなユーザーの詳細情報 (username、email、利用可能な認証方法など) を提供します。import { useUser } from '@auth0/auth0-acul-react/login-email-verification';
function UserProfile() {
const user = useUser();
}
useLoginEmailVerification
このフックは、login-email-verification 画面で利用できるすべてのメソッドとコンテキストを返します。
このメソッドは、メールアドレスの確認を続行するために、ユーザーが入力した確認コードを送信します。import { useLoginEmailVerification } from '@auth0/auth0-acul-react/login-email-verification';
function VerifyEmail() {
const { continueWithCode } = useLoginEmailVerification();
return (
<button onClick={() => continueWithCode({ code: '123456' })}>
Verify
</button>
);
}
メソッドパラメーター
[`key`: `string`]
"string" | "number" | "boolean" | "undefined"
ulp- を接頭辞に持つ追加のカスタムフィールド (例: 'ulp-custom-field') 。
このメソッドは、ユーザーのメールアドレスに新しい確認コードを送信するようリクエストします。import { useLoginEmailVerification } from '@auth0/auth0-acul-react/login-email-verification';
function ResendCode() {
const { resendCode } = useLoginEmailVerification();
return (
<button onClick={() => resendCode()}>
Resend Code
</button>
);
}
メソッドパラメーター
[`key`: `string`]
"string" | "number" | "boolean" | "undefined"
ulp- を接頭辞に持つ追加のカスタムフィールド (例: 'ulp-custom-field') 。
このフックは、ブランディングコンテキストから、フラット化された設定を含む現在のテーマオプションを取得します。
このフックは、現在の ACUL 画面の表示言語を変更するための関数を返します。
このフックは、現在の画面のコンテキストと state を取得します。
このフックは、画面上のサーバー、クライアント、および開発者エラーを読み取り、管理します。
このフックは、code の再送アクションにおけるクールダウン状態と利用可否を管理します。