更改 Google 帐户选择器显示的域 [英] Changing the domain shown by Google Account Chooser

查看:29
本文介绍了更改 Google 帐户选择器显示的域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网络应用中,我们使用 Firebase 身份验证来管理登录和(基本)帐户创建.当用户使用 Google 登录选项时,如果有多个 Google 帐户处于活动状态,则会向用户显示 Google 帐户选择器,以选择在我们的网站上使用哪个帐户.它的标题看起来像这样:

In a web app we are using Firebase Auth to manage logins and (basic) account creation. When using the Google Login option with the user active with more than one Google account, the user is shown the Google Account Chooser to choose which of the accounts to use on our site. Its heading looks something like this:

选择一个帐户
继续mydomain.com

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

In my web app's case, instead of showing mydomain.com, it is showing <firebase-project-id>.firebaseapp.com.

我需要做些什么才能更改帐户选择器弹出窗口显示 mydomain.com?

What do I have to do to change is so that the account chooser popup shows mydomain.com?

推荐答案

如果你想自定义:选择一个帐户以继续:https://auth.example.com您需要按照以下说明进行操作:

If you want to customize that to: Choose an account to continue to: https://auth.example.com You would need to follow the following instructions:

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

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

这篇关于更改 Google 帐户选择器显示的域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆