问题描述
在网络应用中,我们使用Firebase Auth来管理登录名和(基本)帐户创建.如果在具有多个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 ,而是显示了< firebase-project-id> .firebaseapp.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控制台中将以下URL作为授权域列入白名单(身份验证->登录方法->授权域):auth.example.com
- 您需要将此页面白名单作为所有支持的提供商(Google,Facebook,Twitter,LinkedIn)的OAuth重定向URL: https://auth.example.com/__/auth/handler
-
最后,您需要在JS客户端调用中将该域替换为您的
authDomain
:
- You would need to have your custom domain auth.example.com point to example.firebaseapp.com which is hosted by Firebase Hosting.
- You would then make sure you whitelist the following URL in the Firebase Console as an authorized domain (Authentication -> SIGN-IN METHOD->Authorized domains): auth.example.com
- You need to whitelist this page as the OAuth redirect URL for all your supported providers (Google, Facebook, Twitter, LinkedIn): https://auth.example.com/__/auth/handler
Finally, you need to substitute that domain as your
authDomain
in the JS client call:
var config = { apiKey: "...", authDomain: "auth.example.com", ...};
var config = { apiKey: "...", authDomain: "auth.example.com", ...};
这篇关于更改Google帐户选择器显示的域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!