更改 Google 帐户选择器显示的域

Changing the domain shown by Google Account Chooser

在网络应用程序中,我们使用 Firebase Auth 来管理登录和(基本)帐户创建。当用户使用 Google 登录选项并激活多个 Google 帐户时,用户会看到 Google 帐户选择器以选择要在我们网站上使用的帐户。它的标题看起来像这样:

Choose an account
to continue to mydomain.com

在我的网络应用程序中,显示的不是 mydomain.com,而是 .firebaseapp.com.

我需要做的更改是让帐户选择器弹出窗口显示 mydomain.com?

如果您想将其自定义为: 选择一个帐户以继续:https://auth.example.com 您需要遵循以下说明:

  • 您需要让自定义域 auth.example.com 指向由 Firebase Hosting 托管的 example.firebaseapp.com。
  • 然后您将确保在 Firebase 控制台中将以下 URL 列入白名单作为授权域(身份验证 -> 登录方法 -> 授权域):auth.example.com
  • 您需要将此页面列入白名单作为 OAuth 重定向 URL 所有支持的提供商(Google、Facebook、Twitter、LinkedIn):https://auth.example.com/__/auth/handler
  • 最后,您需要在 JS 客户端调用中将该域替换为您的 authDomain

    var config = { apiKey: "...", authDomain: "auth.example.com", ... };