> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# LoginPassword

> Describes all the hooks and methods available to customize the Universal Login `login-password` screen.

The `login-password` screen collects the user's password as the second step of an identifier-first authentication flow. It also supports switching to a federated identity provider or an alternate connection.

![ACUL Login Password](https://mintlify.s3.us-west-1.amazonaws.com/docs-dev/images/cdy7uua7fh8z/Em8VqaD4fPUx6FRevD8fh/a9133a19565d5d9ddc1454535a0a7a11/loginpassword.png)

## Import

Each screen has its own set of hooks and methods. The SDK supports **partial import** and **root import** for each screen.

* Using partial import allows you to include only the code you need for your specific use case.
* Using root import allows you to load all screens from a single bundle, which is useful when you want a unified build to handle all possible screens.

```jsx Import Example theme={null}
// root import
import { useLoginPassword } from '@auth0/auth0-acul-react';

// partial import
import {
  useLoginPassword,
  // Context hooks
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  useExperiment,
  // Common hooks
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  // Utility hooks
  useChangeLanguage,
  // Methods
  login,
  federatedLogin,
  switchConnection,
  switchToOtp,
} from '@auth0/auth0-acul-react/login-password';

function LoginPasswordForm() {
  const { login } = useLoginPassword();
  return (
    <button onClick={() => login({ username: 'user@example.com', password: 'secret' })}>
      Sign In
    </button>
  );
}
```

## Context Hooks

Screen-scoped hooks that provide read-only access to Auth0 context data on the `login-password` screen. Import them from `@auth0/auth0-acul-react/login-password`.

**useBranding** `() => [BrandingMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/BrandingMembers)`

This hook provides branding configurations, such as logo, colors, and theme settings displayed on the `login-password` screen.

```jsx Example theme={null}
import { useBranding } from '@auth0/auth0-acul-react/login-password';
function CustomTheme() {
  const branding = useBranding();
}
```

**useClient** `() => [ClientMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/ClientMembers)`

This hook provides client-related configurations, such as `id`, `name`, and `logoUrl`, for the `login-password` screen.

```jsx Example theme={null}
import { useClient } from '@auth0/auth0-acul-react/login-password';
function AppInfo() {
  const client = useClient();
}
```

**useExperiment** `() => [ExperimentMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/ExperimentMembers)`

This hook provides the active [Experiment Center](/docs/docs/customize/experiment-center) experiment for the `login-password` screen, or `null` when no experiment is active (or the screen has not opted in via `context_configuration`).

```jsx Example theme={null}
import { useExperiment } from '@auth0/auth0-acul-react/login-password';
function ExperimentBranch() {
  const experiment = useExperiment();
  if (!experiment) return null;
  return experiment.isControl ? <ControlUI /> : <TreatmentUI />;
}
```

**useOrganization** `() => [OrganizationMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/OrganizationMembers)`

This hook provides information about the user's Organization if the login is Organization scoped. Returns `null` when no Organization context is present.

```jsx Example theme={null}
import { useOrganization } from '@auth0/auth0-acul-react/login-password';
function OrgSelector() {
  const organization = useOrganization();
  if (!organization) {
    return <p>No organization context</p>;
  }
}
```

**usePrompt** `() => [PromptMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/PromptMembers)`

This hook contains data about the current prompt in the authentication flow.

```jsx Example theme={null}
import { usePrompt } from '@auth0/auth0-acul-react/login-password';
function FlowInfo() {
  const prompt = usePrompt();
}
```

**useScreen** `() => [ScreenMembersOnLoginPassword](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/ScreenMembersOnLoginPassword)`

This hook contains details specific to the `login-password` screen, including its configuration and context.

```jsx Example theme={null}
import { useScreen } from '@auth0/auth0-acul-react/login-password';
function ScreenDebug() {
  const screen = useScreen();
}
```

**useTenant** `() => [TenantMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/TenantMembers)`

This hook contains data related to the tenant, such as `id` and associated metadata.

```jsx Example theme={null}
import { useTenant } from '@auth0/auth0-acul-react/login-password';
function TenantInfo() {
  const tenant = useTenant();
}
```

**useTransaction** `() => [TransactionMembersOnLoginPassword](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/TransactionMembersOnLoginPassword)`

This hook provides transaction-specific data for the `login-password` screen, such as active connections and current flow state.

```jsx Example theme={null}
import { useTransaction } from '@auth0/auth0-acul-react/login-password';
function TransactionInfo() {
  const transaction = useTransaction();
}
```

**useUntrustedData** `() => [UntrustedDataMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/UntrustedDataMembers)`

This hook handles untrusted data passed to the screen, such as a prefilled identifier from URL parameters.

```jsx Example theme={null}
import { useUntrustedData } from '@auth0/auth0-acul-react/login-password';
function PrefilledForm() {
  const untrustedData = useUntrustedData();
}
```

**useUser** `() => [UserMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/UserMembers)`

This hook provides details of the active user, including `username`, `email`, and available authentication methods.

```jsx Example theme={null}
import { useUser } from '@auth0/auth0-acul-react/login-password';
function UserProfile() {
  const user = useUser();
}
```

**useLoginPassword** `[LoginPasswordMembers](/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/LoginPasswordMembers)`

This hook returns all methods and context available on the `login-password` screen.

## Methods

**federatedLogin** `Promise\<void\>`

This method redirects the user to the [Social](/docs/docs/authenticate/identity-providers/social-identity-providers) or [Enterprise Identity Provider](/docs/docs/authenticate/identity-providers/enterprise-identity-providers) (IdP) for authentication.

```jsx Example theme={null}
import { useLoginPassword } from '@auth0/auth0-acul-react/login-password';

function SocialButton() {
  const { federatedLogin } = useLoginPassword();
  return (
    <button onClick={() => federatedLogin({ connection: 'google-oauth2' })}>
      Sign in with Google
    </button>
  );
}
```

**Method Parameters**

**Parameters**

**options**

[FederatedLoginPayloadOptions](/docs/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/FederatedLoginPayloadOptions).

**connection** `string` *required*

The Social or Enterprise Identity Provider connection name.

**\[`key`: `string`]** `"string" | "number" | "boolean" | "undefined"`

Additional custom fields prefixed with `ulp-` (for example, `'ulp-custom-field'`).

**login** `Promise\<void\>`

This method submits the user's credentials to complete authentication on the `login-password` screen.

```jsx Example theme={null}
import { useLoginPassword } from '@auth0/auth0-acul-react/login-password';

function LoginPasswordForm() {
  const { login } = useLoginPassword();
  return (
    <button onClick={() => login({ username: 'user@example.com', password: 'secret' })}>
      Sign In
    </button>
  );
}
```

**Method Parameters**

**Parameters**

**options**

[LoginPasswordOptions](/docs/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/LoginPasswordOptions).

**username** `string` *required*

The identifier (email, phone number, or username) to authenticate with.

**password** `string` *required*

The password for authentication.

**captcha?** `string`

Captcha value required when bot detection is enabled on the tenant.

**\[`key`: `string`]** `"string" | "number" | "boolean" | "undefined"`

Additional custom fields prefixed with `ulp-` (for example, `'ulp-custom-field'`).

**switchConnection** `Promise\<void\>`

This method switches to an alternate authentication connection without restarting the flow.

```jsx Example theme={null}
import { useLoginPassword } from '@auth0/auth0-acul-react/login-password';

function ConnectionSwitcher() {
  const { switchConnection } = useLoginPassword();
  return (
    <button onClick={() => switchConnection({ connection: 'enterprise-saml' })}>
      Use SSO
    </button>
  );
}
```

**Method Parameters**

**Parameters**

**options**

[SwitchConnectionOptionsLoginPassword](/docs/docs/libraries/acul/react-sdk/API-Reference/Types/interfaces/SwitchConnectionOptionsLoginPassword).

**connection** `string` *required*

The connection name to switch to. Use 'email' or 'sms' for passwordless, or a DB connection name for password-based authentication.

**switchToOtp** `Promise\<void\>`

This method switches from password entry to a one-time-passcode challenge for this login.

Check `screen.data.showSwitchToOtpButton` before rendering the option — it indicates whether the switch is available for this transaction.

```jsx Example theme={null}
import { useLoginPassword } from '@auth0/auth0-acul-react/login-password';

function OtpSwitchButton() {
  const { switchToOtp } = useLoginPassword();
  return (
    <button onClick={() => switchToOtp()}>
      Use a one-time code instead
    </button>
  );
}
```

## Common/Utility Hooks

**[useAuth0Themes](/docs/docs/libraries/acul/react-sdk/API-Reference/Hooks/useAuth0Themes)** `Hooks`

This hook gets the current theme options with flattened configuration from branding context.

**[useChangeLanguage](/docs/docs/libraries/acul/react-sdk/API-Reference/Hooks/useChangeLanguage)** `Hooks`

This hook returns a function for changing the display language on the current ACUL screen.

**[useCurrentScreen](/docs/docs/libraries/acul/react-sdk/API-Reference/Hooks/useCurrentScreen)** `Hooks`

This hook gets the current screen context and state.

**[useErrors](/docs/docs/libraries/acul/react-sdk/API-Reference/Hooks/useErrors)** `Hooks`

This hook reads and manages server, client, and developer errors on the screen.
