workerbee
workerbee

Reputation: 243

Google Actions & Auth0 account linking multiple languages

Our account linking from Google Actions to Auth0 works. We use the Authorization Code flow with https://xxx.auth0.com/authorize?xxx. We now need to release the Google Action in multiple languages. During a user's initial account linking process, how do we make Auth0 display the sign in screen in the right language based on the locale setting on the user's phone?

Upvotes: 0

Views: 197

Answers (1)

workerbee
workerbee

Reputation: 243

The fix for us is to set the language in the Auth0 Universal Login template.

var language = 'en';
if (navigator && navigator.language && navigator.language.length > 1) {
    language = navigator.language.substr(0, 2); 
    // you may need better language validation here. 
    // why substr? auth0 doesn't like en-US and we don't need pt-*, zh-*. 
    // See auth0 language list https://auth0.com/docs/universal-login/i18n
}

var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
    language:language,
    // other fields...
}
lock.show();

Upvotes: 1

Related Questions