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

# LoginPasswordlessSmsOtp

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

The `login-passwordless-sms-otp` screen prompts the user to enter a one-time password sent to their phone number to complete passwordless SMS authentication.

![Login Passwordless SMS OTP](https://mintlify.s3.us-west-1.amazonaws.com/docs-dev/images/cdy7uua7fh8z/7CNCkaU1uPRbEUsAyqlj8u/8461823cf224471d19656e4dd9027a87/Screenshot_2025-04-24_at_11.31.00.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 { useLoginPasswordlessSmsOtp } from '@auth0/auth0-acul-react';

// partial import
import {
  useLoginPasswordlessSmsOtp,
  // Context hooks
  useUser,
  useTenant,
  useBranding,
  useClient,
  useOrganization,
  usePrompt,
  useScreen,
  useTransaction,
  useUntrustedData,
  useExperiment,
  // Common hooks
  useCurrentScreen,
  useAuth0Themes,
  useErrors,
  // Utility hooks
  useChangeLanguage,
  useResend,
  // Methods
  submitOTP,
  resendOTP,
  switchConnection,
} from '@auth0/auth0-acul-react/login-passwordless-sms-otp';

function SmsOtpForm() {
  const { submitOTP } = useLoginPasswordlessSmsOtp();
  return (
    <button onClick={() => submitOTP({ code: '123456' })}>
      Verify Code
    </button>
  );
}
```

## Context Hooks

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

**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-passwordless-sms-otp` screen.

```jsx Example theme={null}
import { useBranding } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';
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-passwordless-sms-otp` screen.

```jsx Example theme={null}
import { useClient } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';
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-passwordless-sms-otp` 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-passwordless-sms-otp';
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-passwordless-sms-otp';
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-passwordless-sms-otp';
function FlowInfo() {
  const prompt = usePrompt();
}
```

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

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

```jsx Example theme={null}
import { useScreen } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';
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-passwordless-sms-otp';
function TenantInfo() {
  const tenant = useTenant();
}
```

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

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

```jsx Example theme={null}
import { useTransaction } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';
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 phone number from URL parameters.

```jsx Example theme={null}
import { useUntrustedData } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';
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-passwordless-sms-otp';
function UserProfile() {
  const user = useUser();
}
```

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

This hook returns all methods and context available on the `login-passwordless-sms-otp` screen.

## Methods

**resendOTP** `Promise\<void\>`

Resends the one-time password (OTP) to the user's phone number.

This method submits a form to Auth0. Auth0 renders this screen again. If a captcha is required, Auth0 sends the user back to the `login-id` screen instead, or to the `signup-id` screen if the user started from signup. In both cases, the browser loads a new page and React state, effects, and timers are lost.

When you call `resendOTP()`, keep the following in mind:

* Code that runs after `await resendOTP()` can't rely on state that the code sets, such as a "code sent" message or a countdown.
* If Auth0 can't send the SMS, for example because of a rate limit, Auth0 renders this screen again without an error. Only extensibility errors, such as an error from an Action, and unexpected failures appear in `useErrors()` after the page reloads. The returned promise doesn't reject.
* The returned promise resolves when the form is submitted, before the new page loads. The promise doesn't confirm that Auth0 sent a new code.

To add a cooldown between resends, use `useResend()`. The `useResend()` hook stores the countdown in `localStorage`, so the countdown persists across the page reload.

```jsx Example theme={null}
import { useLoginPasswordlessSmsOtp } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';

function ResendButton() {
  const { resendOTP } = useLoginPasswordlessSmsOtp();
  return (
    <button onClick={() => resendOTP()}>
      Resend Code
    </button>
  );
}
```

**submitOTP** `Promise\<void\>`

This method submits the one-time password to complete passwordless SMS authentication.

```jsx Example theme={null}
import { useLoginPasswordlessSmsOtp } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';

function SmsOtpForm() {
  const { submitOTP } = useLoginPasswordlessSmsOtp();
  return (
    <button onClick={() => submitOTP({ code: '123456' })}>
      Verify Code
    </button>
  );
}
```

**Method Parameters**

**Parameters**

**options**

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

**code** `string` *required*

The one-time password sent to the user's phone number.

**username?** `string`

The user's phone number or identifier, if required by the flow.

**captcha?** `string`

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

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

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

```jsx Example theme={null}
import { useLoginPasswordlessSmsOtp } from '@auth0/auth0-acul-react/login-passwordless-sms-otp';

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

**Method Parameters**

**Parameters**

**options**

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

**connection** `string` *required*

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

## 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.

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

Manages the resend cooldown for this screen. The hook returns the remaining seconds, whether resending is disabled, and a `startResend()` function that triggers the resend and starts the cooldown. The countdown persists across the page reload that a resend causes.
