在 generateEmailVerificationLink() FirebaseAdmin SDK 上更改 URL 的语言

Change language of URL on generateEmailVerificationLink() FirebaseAdmin SDK

我想更改生成函数 generateEmailVerificationLink () 的 link 的语言,我尝试了 admin.auth().LanguageCode = 'es',但没有成功工作。

这是我的代码:

  // Function for creating to validation link with firebase admin
async getLinkForEmailVerification(email) {
    admin.auth().languageCode= 'es';
    const actionCodeSettings = {
        url: 'http://localhost:4200/login',
    };

    return admin.auth().generateEmailVerificationLink(email, actionCodeSettings).then((link) => link);
}

我在 node.js

中使用 firebase admin

手动自定义 - 将 lang 参数附加到 link:

async getLinkForEmailVerification(email) {
  const actionCodeSettings = {
    url: 'http://localhost:4200/login',
  };

  let link = await admin.auth().generateEmailVerificationLink(email, actionCodeSettings);
  link += '&lang=es'; // this line

  return link;
}