
Before you begin
Before you can implement flexible language selection, ensure the following requirements are met:-
Use Universal Login.
- This feature is not available for custom login pages.
- Configure a custom domain.
-
Enable the languages you plan to add to your prompts in your Auth0 tenant.
-
On the Auth0 Dashboard, navigate to Settings > General > Languages and enable one or more desired languages.
- For more information, review Universal Login Internationalization.
-
On the Auth0 Dashboard, navigate to Settings > General > Languages and enable one or more desired languages.
Implement flexible language selection
Setting up flexible language selection includes two primary steps:- Preparing your page template to facilitate language selection.
- Configuring individual prompts to display language selection to users.
Prepare your Universal Login page template
To get started, add the following script to your Universal Login page template to facilitate language selection.Be aware that this call will overwrite any existing configurations you have made to your Universal Login page template. To avoid any disruptions, ensure you include all necessary page template customizations in this call.
Configure individual Universal Login prompts
Next, add language selection to one or more Universal Login prompts by configuring custom 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 add language selection to a specific prompt, use the Auth0 to configure custom prompt partials with the following parameters:Parameter | Description | Example Value |
---|---|---|
language | Required. One or more languages to include in the language selection menu displayed to users. | es ,fr ,en |
persist | Required. Determines whether the language should persist across the session. | session |
action | Optional. Use this parameter in situations where you want users to be able to update their language without advancing the prompt. If the value is provided, the form is not automatically submitted when a user changes their language. Otherwise, the prompt automatically advances when a different language is selected. | change-language |
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.
Signup Prompt: Identifier + Password
Signup Prompt: Identifier + Password
To add language selection to the
signup
prompt, use the Set partials for a prompt endpoint:Login Prompt: Identifier First
Login Prompt: Identifier First
To add language selection to the
login-id
prompt, use the Set partials for a prompt endpoint:Login Prompt: Passwordless (Email)
Login Prompt: Passwordless (Email)
To add language selection to the
login-passwordless-email-code
prompt, use the Set partials for a prompt endpoint: