@auth0/auth0-acul-react

中文文档
1.11.0发布于 2026/11/05MITTypeScriptES Module构建来源已验证近 30 天下载 51.1万

The Auth0 ACUL React SDK enables you to build Advanced Customization for Universal Login with React hooks and components.

原始使用文档
文档目录17 节
  1. 📚 Documentation
  2. 🚀 Getting started
  3. Prerequisites
  4. Installation
  5. Importing the SDK
  6. 💻 API Reference
  7. Screens
  8. Hooks
  9. Context Hooks (Available in all screens)
  10. Utility Hooks
  11. Common Hooks
  12. Screen-Specific Action Methods
  13. Examples
  14. 💬 Feedback
  15. Contributing
  16. Raise an issue
  17. Vulnerability Reporting

Auth0 ACUL React SDK

ACUL React SDK

NPM Version Downloads codecov License

📚 Documentation | 🚀 Getting Started | 💻 API Reference | 🪝 Hooks | Examples | 💬 Feedback

Developers using Auth0's Universal Login can use this React SDK to customize screens like login, signup, or reset password. It provides hooks, context, and utilities to build flexible, type-safe experiences that match your brand and deliver a seamless user experience.


📚 Documentation

  • Quickstart - our guide for setting up the SDK on your app.
  • Guides - more guides for common use cases
  • Examples - code snippets for different customization use cases.

🚀 Getting started

Prerequisites

Before starting, ensure that you have the following setup:

  1. Custom Domain: Ensure that a custom domain is configured for your Auth0 tenant.
  2. Screen Configuration: Set up the required authentication screens within your Auth0 flow.
    For detailed steps, refer to the Configure ACUL Screens.

Installation

npm install @auth0/auth0-acul-react

Peer dependency:

npm install react

Importing the SDK

The SDK supports partial imports for each screen, allowing you to include only the code you need for your specific use case. This helps keep your bundle size small and improves performance.

Also, you can use a root import to load all screens from a single bundle if your app requires it.

Partial Imports

Each screen has its own set of hooks and methods. You can import only what you need for the screen you're building.

The following example shows how to import and use SDK to build login-id screen.

import { 
  // Context hooks
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTenant,
  useTransaction,
  useUser,
  useUntrustedData,
  // Common hooks
  useErrors,
  useTexts,
  // Utility hooks
  useUsernameValidation,
  usePasswordValidation,
  useLoginIdentifiers,
  // Submit methods
  login,
  passkeyLogin,
  federatedLogin,
} from '@auth0/auth0-acul-react/login-id';

Root Imports

The SDK also supports a root import, which lets you load all screens from a single bundle. This is useful if your app dynamically renders different screens at runtime based on the current Auth0 flow, for example, when you want one unified build that can handle all possible screens.

However, root imports aren’t ideal for most projects since they can increase bundle size. If you only need specific screens, use partial imports instead for better performance.

import {
  // Common hooks
  useCurrentScreen,
  useAuth0Themes,
  useErrors,

  // Screen-specific hooks for multiple screens
  useLoginId,
  useSignupId,
  useResetPassword
} from '@auth0/auth0-acul-react';

Types / Interfaces

Typescript types and interfaces can be imported from @auth0/auth0-acul-react/types for type safety and better DX.

import type {
  Connection,
  CustomOptions,
  IdentifierType,
  Organizations,
  EnrolledDevice
  // ...other types
} from '@auth0/auth0-acul-react/types';

Refer to our API Reference for the full list of available types and interfaces.


💻 API Reference

Screens

No.PromptScreen NameDocumentation Link
1loginloginLink
2login-idlogin-idLink
3login-passwordlogin-passwordLink
4signup-idsignup-idLink
5signup-passwordsignup-passwordLink
Explore more screens...
No.PromptScreen NameDocumentation Link
6login-passwordlesslogin-passwordless-email-codeLink
7login-passwordlesslogin-passwordless-sms-otpLink
8passkeyspasskey-enrollmentLink
9passkeyspasskey-enrollment-localLink
10phone-identifier-enrollmentphone-identifier-enrollmentLink
11phone-identifier-challengephone-identifier-challengeLink
12email-identifier-challengeemail-identifier-challengeLink
13captchainterstitial-captchaLink
14reset-passwordreset-password-emailLink
15reset-passwordreset-password-requestLink
16reset-passwordreset-passwordLink
17reset-passwordreset-password-errorLink
18reset-passwordreset-password-successLink
19signupsignupLink
20mfamfa-detect-browser-capabilitiesLink
21mfamfa-enroll-resultLink
22mfamfa-begin-enroll-optionsLink
23mfamfa-login-optionsLink
24mfa-pushmfa-push-enrollment-qrLink
25mfa-pushmfa-push-welcomeLink
26mfa-pushmfa-push-challenge-pushLink
27mfa-pushmfa-push-listLink
28mfa-smsmfa-country-codesLink
29mfa-smsmfa-sms-challengeLink
30mfa-smsmfa-sms-enrollmentLink
31mfa-smsmfa-sms-listLink
32mfa-emailmfa-email-challengeLink
33mfa-emailmfa-email-listLink
34invitatinoaccept-invitationLink
35organizationsorganization-pickerLink
36organizationsorganization-selectionLink
37reset-passwordmfa-otp-challengeLink
38mfa-otpmfa-otp-enrollment-codeLink
39mfa-otpmfa-otp-enrollment-qrLink
40reset-passwordreset-password-mfa-email-challengeLink
41reset-passwordreset-password-mfa-push-challenge-pushLink
42reset-passwordmfa-sms-challengeLink
43reset-passwordreset-password-mfa-otp-challengeLink
44mfa-phonemfa-phone-enrollmentLink
45mfa-voicemfa-voice-enrollmentLink
46mfa-recovery-codemfa-recovery-code-challengeLink
47device-flowdevice-code-activation-allowedLink
48device-flowdevice-code-activation-deniedLink
49device-flowdevice-code-activationLink
50reset-passwordreset-password-mfa-recovery-code-challengeLink
51reset-passwordreset-password-mfa-voiceLink
52commonredeem-ticketLink
53device-flowdevice-code-confirmationLink
54mfa-phonemfa-phone-challengeLink
55mfa-voicemfa-voice-challengeLink
56mfa-recovery-codemfa-recovery-code-enrollmentLink
57reset-passwordreset-password-mfa-phone-challengeLink
58mfa-recovery-codemfa-recovery-code-challenge-new-codeLink
59logoutlogoutLink
60logoutlogout-abortedLink
61logoutlogout-completeLink
62email-verificationemail-verification-resultLink
63login-email-verificationlogin-email-verificationLink
64mfa-webauthnmfa-webauthn-platform-enrollmentLink
65mfa-webauthnmfa-webauthn-errorLink
66mfa-webauthnmfa-webauthn-roaming-enrollmentLink
67mfa-webauthnmfa-webauthn-roaming-challengeLink
68mfa-webauthnmfa-webauthn-platform-challengeLink
69mfa-webauthnmfa-webauthn-enrollment-successLink
70mfa-webauthnmfa-webauthn-change-key-nicknameLink
71mfa-webauthnmfa-webauthn-not-available-errorLink
72reset-passwordreset-password-mfa-webauthn-platform-challengeLink
73reset-passwordreset-password-mfa-webauthn-roaming-challengeLink
74consentconsentLink
75customized-consentcustomized-consentLink
76email-otp-challengeemail-otp-challengeLink
77confirmationconfirmationLink
78consentpending-consentLink

Hooks

Context Hooks (Available in all screens)

  • useUser() - Current user information
  • useTenant() - Tenant configuration
  • useClient() - Application client information
  • useScreen() - Current screen data and configuration
  • useTransaction() - Transaction state and methods
  • useBranding() - Tenant branding and theme
  • useOrganization() - Organization context (if applicable)
  • usePrompt() - Current authentication prompt
  • useUntrustedData() - Untrusted data from the authentication flow
  • useExperiment() - Active Experiment Center experiment for the current screen (experimentId, variationId, variationName, variationDescription, config, isControl), or null when no experiment is active or the screen has not opted in via context_configuration

Available on specific screens

  • useCountryCodes() - Available phone country codes and the recommended default. Exported only from login, login-id, signup, and signup-id.

Utility Hooks

Specialized hooks for form validation, polling, and identifier management:

Identifier Management

  • useLoginIdentifiers() - Get available login identifier types (email, phone, username)
  • useSignupIdentifiers() - Get available signup identifier types, each with its required status

Form Validation

  • usePasswordValidation(password, rules) - Real-time password strength validation
  • useUsernameValidation(username) - Username format and availability validation

MFA & Polling

  • useMfaPolling(options) - Manage MFA push notification polling lifecycle (also polls the consent outcome on pending-consent)
  • useResend(options) - Handle resend operations with cooldown timers

Common Hooks

General-purpose hooks available across all screens:

Screen Management

  • useCurrentScreen() - Get complete current screen context data
  • useAuth0Themes() - Access tenant branding and theme configuration

Error Handling

  • useErrors(options) - Comprehensive error management with categorization
    • Filter by error kind: 'validation', 'auth0', 'configuration'
    • Filter by field name for form-specific errors
    • Dismiss individual or all errors

Screen-Specific Action Methods

Each screen module exports methods for screen actions:

// Login ID Screen
import {
  loginMethod,
  continueWithFederatedLogin
} from '@auth0/auth0-acul-react/login-id';

// Password Screen
import {
  loginMethod,
  forgotPasswordMethod
} from '@auth0/auth0-acul-react/login-password';

// MFA Push Challenge
import {
  continueMethod,
  resendPushNotification,
  useMfaPolling
} from '@auth0/auth0-acul-react/mfa-push-challenge-push';

Examples


💬 Feedback

Contributing

We appreciate feedback and contribution to this repo! Before you get started, please see the following:

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker.

Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.


Auth0 Logo

Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0?

This project is licensed under the MIT license. See the LICENSE file for more info.

版本与发布记录

@auth0/auth0-acul-react 共发布 17 个版本,首次发布于 2025/10/14;过去 12 个月发布了 14 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.11.0latest2026/11/052 天前
1.10.02026/10/2315 天前
1.9.02026/09/241 个月前
1.8.02026/09/161 个月前
1.7.02026/08/252 个月前
1.6.02026/07/173 个月前

其他发布通道:alpha → 1.0.0-alpha.4。

关于 @auth0/auth0-acul-react 的常见问题

@auth0/auth0-acul-react 是什么?

The Auth0 ACUL React SDK enables you to build Advanced Customization for Universal Login with React hooks and components.

如何安装 @auth0/auth0-acul-react?

在项目目录运行 npm install @auth0/auth0-acul-react,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.0.0)、react-dom(>=18.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@auth0/auth0-acul-react 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@auth0/auth0-acul-react 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@auth0/auth0-acul-react 可以商用吗?

@auth0/auth0-acul-react 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@auth0/auth0-acul-react 的下载量有多少?

根据 npm 官方下载统计,@auth0/auth0-acul-react 在 2026/10/07 – 2026/11/05 这 30 天内被下载 511,093 次,日均约 17,036 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@auth0/auth0-acul-react 还在维护吗?

最新版本 1.11.0 发布于 2026/11/05(2 天前);至今共发布 17 个版本,其中过去 12 个月发布了 14 个;首次发布于 2025/10/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。