Set the locale for custom template in New Universal Login flow

We’re using custom login templates with the New Universal Login flow. We have the user’s language preference stored in our app so we would like to be able to set the language/locale explicitly for the login prompts. According to this page the locale is detected from the user’s Accept-language browser header, however is there a way to override this and pass the locale explicitly?

We are using Next.js and currently have an API handler setup like follows:


export const GET = handleAuth({
  login: handleLogin({ authorizationParams: { connection: "email" }, returnTo: "/auth-success" }),
  signup: handleLogin({
    authorizationParams: { connection: "email", screen_hint: "signup", returnTo: "/auth-success" },
  }),
});

It doesn’t look like there’s a way to pass the locale via handleLogin(), or in the URL for the login path /api/auth/login?ui_locales=de or to the auth0 widget in the custom template?

We have configured the languages in the tenant settings to allow English (default) and German such that if we change the Accept-Language header in the browser the language of the login prompt will change, but is there a way override this?

Hi @richard8,

Welcome to the Auth0 Community!

You tried passing it in the authorizationParams object? i.e.

handleLogin({ 
  authorizationParams: {
    ui_locales:'de'
    }
})
1 Like

Thanks Dan, that worked. Couldn’t find it in the examples or docs.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.