我已在我的应用程序中实现Firebase Auth,以使我的用户与他们的Google帐户建立联系。到目前为止,到目前为止还不错,但是一旦用户选择了与Google帐户选择器弹出窗口中的特定帐户建立联系,他下次登录时将无法选择其他帐户。先前选择的帐户将被自动选择用于身份验证。
我确实发现此行为不正确,所以我正在尝试修复它。经过研究,我发现可以将setCustomParameters(prompt: "select_account")
与googleProvider
结合使用,如下所示:
this.googleProvider = new firebase.auth.GoogleAuthProvider();
this.googleProvider.setCustomParameters({
prompt: "select_account",
});
此处有更多信息:https://developers.google.com/identity/protocols/oauth2/openid-connect#authenticationuriparameters
就我而言,使用consent
和select_account
参数似乎没有任何影响,用户无法选择要使用的帐户。
编辑:看来它可以与chrome一起正常使用,但不能与Firefox ...
我已经找到问题的根源,实际上这并不是真正的问题。仅当您当前正在使用的设备/浏览器上注册了其他帐户时,才会显示Google帐户选择器。如果您想选择一个未保存到设备/浏览器中的其他帐户,则首先需要通过google登录。