Firebase google auth automatically selecting user. How to force it to select account

喜欢而已 提交于 2019-12-19 02:59:04

问题


If in any browser, when i am logged in with single google account and try to invoke 'sign in with google' option on firebase, it is automatically logging-in to firebase with the already logged in account. It gives me no option to login with a different account. This happens only if one account is logged in browser. Multiple accounts doesn't create this problem. So, it is any way I can force users to choose accounts everytime they click 'sign in with google' button?


回答1:


This worked for me: https://groups.google.com/forum/#!topic/firebase-talk/gxBm0WKCuIY

var provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({
  prompt: 'select_account'
});



回答2:


If you're authenticating the user credential Using Google Sign-In with JavaScript, try to remove the follow line of code:

provider.addScope('https://www.googleapis.com/auth/plus.login');

After you clicked the sign in button, it will allow you to select a Google account that you want to use.



来源:https://stackoverflow.com/questions/39032255/firebase-google-auth-automatically-selecting-user-how-to-force-it-to-select-acc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!