简体   繁体   English

链接多种语言的 Google Actions 和 Auth0 帐户

[英]Google Actions & Auth0 account linking multiple languages

Our account linking from Google Actions to Auth0 works.我们的帐户从 Google Actions 链接到 Auth0 有效。 We use the Authorization Code flow with https://xxx.auth0.com/authorize?xxx .我们将授权码流程与https://xxx.auth0.com/authorize?xxx一起使用。 We now need to release the Google Action in multiple languages.我们现在需要以多种语言发布 Google Action。 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?在用户的初始帐户链接过程中,我们如何使 Auth0 根据用户手机上的区域设置以正确的语言显示登录屏幕?

The fix for us is to set the language in the Auth0 Universal Login template.我们的解决方法是在 Auth0 通用登录模板中设置语言。

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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM