问题描述
使用Firebase Google用户身份验证时,如果用户已经授权了该应用程序并且仅登录到一个Google帐户,则会立即登录.
When using Firebase Google user authentication the user is immediately logged in if they have already authorized the application and only logged in to one Google account.
是否可以强制显示选择帐户"对话框,以便用户有机会登录到其他Google帐户或创建新帐户?
Is there a way to force the "Choose an account" dialog to appear so that the user has the opportunity to login to a different Google account or create a new one?
据我所知,用户必须从Google.com手动注销当前的Google帐户(或登录到> 1)以显示该对话框.
Currency as far as I know the user has to manually logout of the current Google account (or login to > 1) from Google.com to make the dialog appear.
推荐答案
您可以强制选择带有提示"提供程序参数的帐户.
You can force to choose an account with 'prompt' provider parameter.
var googleAuthProvider = new firebase.auth.GoogleAuthProvider();
googleAuthProvider.setCustomParameters({
prompt: 'select_account'
});
firebase.auth().signInWithRedirect(googleAuthProvider)
经过Firebase JavaScript SDK v4.1.2的测试
Tested with Firebase JavaScript SDK v4.1.2
这篇关于使用Firebase Google用户身份验证更改用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!