signup-password 画面では、アカウント作成を完了するためのパスワードをユーザーに入力してもらいます。これは複数ステップのサインアップフローの 2 番目の手順であり、識別子の入力に続くものです。また、ソーシャル接続またはエンタープライズ接続を使用したフェデレーションサインアップにも対応しています。
各画面には、それぞれ専用のフックとメソッドのセットがあります。SDK は各画面で部分インポートとルートインポートをサポートしています。
- 部分インポートを使用すると、特定のユースケースに必要なコードだけを含めることができます。
- ルートインポートを使用すると、単一のバンドルからすべての画面を読み込めるため、想定されるすべての画面を 1 つのビルドで処理したい場合に便利です。
// ルートインポート
import { useSignupPassword } from '@auth0/auth0-acul-react';
// 部分インポート
import {
useSignupPassword,
// コンテキストフック
useUser,
useTenant,
useBranding,
useClient,
useOrganization,
usePrompt,
useScreen,
useTransaction,
useUntrustedData,
// 共通フック
useCurrentScreen,
useAuth0Themes,
useErrors,
// ユーティリティフック
useChangeLanguage,
usePasswordValidation,
// メソッド
signup,
federatedSignup,
switchConnection,
} from '@auth0/auth0-acul-react/signup-password';
function SignupPasswordForm() {
const { signup } = useSignupPassword();
return (
<button onClick={() => signup({ password: 'secret' })}>
Create Account
</button>
);
}
signup-password 画面で Auth0 のコンテキストデータへの読み取り専用アクセスを提供する、画面スコープのフックです。@auth0/auth0-acul-react/signup-password からインポートします。
このフックは、signup-password 画面に表示されるロゴ、色、テーマ設定などのブランディング構成を提供します。import { useBranding } from '@auth0/auth0-acul-react/signup-password';
function CustomTheme() {
const branding = useBranding();
}
このフックは、signup-password 画面における id、name、logoUrl などのクライアント関連の構成を提供します。import { useClient } from '@auth0/auth0-acul-react/signup-password';
function AppInfo() {
const client = useClient();
}
このフックは、サインアップが組織スコープである場合に、ユーザーの組織に関する情報を提供します。組織コンテキストが存在しない場合は null を返します。import { useOrganization } from '@auth0/auth0-acul-react/signup-password';
function OrgSelector() {
const organization = useOrganization();
if (!organization) {
return <p>No organization context</p>;
}
}
このフックには、認証フローにおける現在のプロンプトに関するデータが含まれます。import { usePrompt } from '@auth0/auth0-acul-react/signup-password';
function FlowInfo() {
const prompt = usePrompt();
}
このフックには、設定やコンテキストなど、signup-password 画面に固有の詳細が含まれます。import { useScreen } from '@auth0/auth0-acul-react/signup-password';
function ScreenDebug() {
const screen = useScreen();
}
このフックには、id や関連するメタデータなど、テナントに関するデータが含まれます。import { useTenant } from '@auth0/auth0-acul-react/signup-password';
function TenantInfo() {
const tenant = useTenant();
}
このフックは、アクティブな接続や現在のフロー状態など、signup-password 画面のトランザクション固有のデータを提供します。import { useTransaction } from '@auth0/auth0-acul-react/signup-password';
function TransactionInfo() {
const transaction = useTransaction();
}
このフックは、URL パラメーターから事前入力されたメールアドレスや username など、画面に渡される信頼できないデータを扱います。import { useUntrustedData } from '@auth0/auth0-acul-react/signup-password';
function PrefilledForm() {
const untrustedData = useUntrustedData();
}
このフックは、username、email、利用可能な認証方法など、アクティブなユーザーの詳細を提供します。import { useUser } from '@auth0/auth0-acul-react/signup-password';
function UserProfile() {
const user = useUser();
}
このフックは、signup-password 画面で利用可能なすべてのメソッドとコンテキストを返します。
このメソッドは、Google や GitHub などのフェデレーテッド IDプロバイダーを介したサインアップを開始します。import { useSignupPassword } from '@auth0/auth0-acul-react/signup-password';
function SocialButton() {
const { federatedSignup } = useSignupPassword();
return (
<button onClick={() => federatedSignup({ connection: 'google-oauth2' })}>
Sign up with Google
</button>
);
}
メソッドパラメーター
使用するソーシャル接続またはエンタープライズ接続の接続名 (例: google-oauth2、github) 。
このメソッドは、アカウント作成を完了するためにユーザーのパスワードを送信します。import { useSignupPassword } from '@auth0/auth0-acul-react/signup-password';
function SignupPasswordForm() {
const { signup } = useSignupPassword();
return (
<button onClick={() => signup({ password: 'secret' })}>
Create Account
</button>
);
}
メソッドパラメーター
接続で必要な場合の、新しいアカウントのユーザー名。
テナントでボット検知が有効な場合に必要なキャプチャ値。
[`key`: `string`]
"string" | "number" | "boolean" | "undefined"
ulp- 接頭辞が付いた追加のカスタムフィールド (例: 'ulp-custom-field') 。
このメソッドは、signup-password ステップで使用中の接続を切り替え、ユーザーが別の接続で認証できるようにします。import { useSignupPassword } from '@auth0/auth0-acul-react/signup-password';
function SwitchConnection() {
const { switchConnection } = useSignupPassword();
return (
<button onClick={() => switchConnection({ connection: 'Username-Password-Authentication' })}>
Use a different method
</button>
);
}
メソッドパラメーター
切り替え先の接続名。パスワードレスの場合は email または sms を、パスワードベースの認証の場合は DB 接続名を使用します。
[`key`: `string`]
"string" | "number" | "boolean" | "undefined"
ulp- 接頭辞が付いた追加のカスタムフィールド (例: 'ulp-custom-field') 。
このフックは、ブランディングコンテキストから、設定をフラット化した現在のテーマオプションを取得します。
このフックは、現在のACUL画面の表示言語を変更するための関数を返します。
このフックは、現在の画面のコンテキストと状態を取得します。
このフックは、画面上のサーバー、クライアント、開発者のエラーを読み取り、管理します。
このフックは、ユーザーのパスワードがテナントのパスワードポリシー要件を満たしているかどうかを検証します。