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

问题描述 投票:0回答:1

我们从Google动作链接到Auth0的帐户有效。我们将授权码流程与https://xxx.auth0.com/authorize?xxx一起使用。现在,我们需要以多种语言发布Google Action。在用户的初始帐户关联过程中,我们如何根据用户电话上的语言环境设置使Auth0以正确的语言显示登录屏幕?

oauth-2.0 internationalization actions-on-google auth0 account-linking
1个回答
0
投票

对我们来说,解决方法是在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();
© www.soinside.com 2019 - 2024. All rights reserved.