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

# Configure Flexible Connection Switching

> Learn how you can implement flexible connection switching with Universal Login

Flexible connection switching is an optional feature that allows users to choose their method of authentication when logging in to an application. When implemented, your application's login screen presents users with the option to authenticate with either traditional database credentials or a passwordless connection. Users who select a [passwordless connection](/docs/docs/authenticate/passwordless) receive a one-time password (OTP) through email or SMS that they can use to log in to your application.

Flexible connection switching uses [custom Universal Login prompts](/docs/docs/customize/login-pages/universal-login/customize-signup-and-login-prompts) to provide users with a more autonomous authentication experience.

## Before you begin

Before you can implement flexible connection switching, ensure the following requirements are met:

* Use [Universal Login](/docs/docs/authenticate/login/auth0-universal-login).

  * This feature is not available for custom login pages.
* Configure a [custom domain](/docs/docs/customize/custom-domains).
* Enable the following for your application:

  * [Identifier First authentication](/docs/docs/authenticate/login/auth0-universal-login/identifier-first)
  * [Database connection](/docs/docs/authenticate/database-connections)
  * [Email or SMS passwordless authentication](/docs/docs/authenticate/login/auth0-universal-login/passwordless-login/email-or-sms)

## Implement flexible connection switching

To implement this feature, use the [Auth0 Management API](/docs/docs/api/management/v2) to configure custom signup and login prompt partials. Partials refer to custom code inserted into an entry point within a prompt screen, such as the login screen. To learn more, review [Customize Signup and Login Prompts](/docs/docs/customize/login-pages/universal-login/customize-signup-and-login-prompts).

To implement flexible connection switching, you will configure custom prompt partials with the following parameters:

| Parameter | Description | Example |
| - | - | - |
| `state` | Renders the current page's state value, which is opaque and used for security purposes. To learn more about current screen information, review [Customize Univeral Login Page Templates](/docs/docs/customize/login-pages/universal-login/customize-templates#current-screen-information). | `<input type='hidden' name='state' value='{{state}}'>` |
| `connection` | Name and type of the connection. For passwordless connections, value is either `email` or `sms`. | `<input type='hidden' name='connection' value='email'>` |

> [!WARNING]
>
> In the code samples below, ensure you replace the placeholders with the appropriate values:
>
> * Replace `{yourDomain}` with `yourdomain.auth0.com`.
> * Replace `{mgmtApiToken}` with your access token.

### Configure signup prompt

You can configure the `signup-password` prompt using the [Set partials for a prompt](/docs/docs/api/management/v2/prompts/put-partials) endpoint:

Using the Auth0 CLI? If you haven't already, [set up and authenticate your CLI session](/docs/docs/deploy-monitor/auth0-cli) before running this command.

As a result, a **Send a secure code by email button** is added to the `signup-password` screen. When a user selects this button, it submits a form body containing the login state parameter and the name of the desired connection.

### Configure login prompts

For best results, configuring the login prompt for both password and passwordless connections is recommended.

You can configure the `login-password` prompt using the [Set partials for a prompt](/docs/docs/api/management/v2/prompts/put-partials) endpoint:

As a result, a **Send a secure code by email button** is added to the `login-password` screen. When a user selects this button, it submits a form body containing the login state parameter and the name of the desired connection.

Similarly, you can configure the `login-passwordless` prompt using the [Set partials for a prompt](/docs/docs/api/management/v2/prompts/put-partials) endpoint:
