Before you begin
Before you can implement flexible connection switching, ensure the following requirements are met:-
Use Universal Login.
- This feature is not available for custom login pages.
- Configure a custom domain.
- Enable the following for your application:
Implement flexible connection switching
To implement this feature, use the Auth0 Management API 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. 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. | <input type=‘hidden’ name=‘state’ value=''> |
connection | Name and type of the connection. For passwordless connections, value is either email or sms . | <input type=‘hidden’ name=‘connection’ value=‘email’> |
In the code samples below, ensure you replace the placeholders with the appropriate values:
- Replace
{yourDomain}
withyourdomain.auth0.com
. - Replace
{mgmtApiToken}
with your access token.
Configure signup prompt
You can configure thesignup-password
prompt using the Set partials for a prompt endpoint:
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 thelogin-password
prompt using the Set partials for a prompt endpoint:
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 endpoint: