简体   繁体   English

Firebase 谷歌验证,退出再登录会用上次登录的账号登录

[英]Firebase Google auth, signing out and logging in again will log in with the last signed account

I am using Firebase Google Auth, signing out and logging in again will log in with the last signed account.我正在使用 Firebase Google 身份验证,退出并再次登录将使用上次登录的帐户登录。 How can I make it show the "choose account" dialog?如何让它显示“选择帐户”对话框? this is what I did to log out.这就是我注销的方法。 FirebaseAuth.getInstance().signOut(); and then I call sign-in activity.然后我调用登录活动。 Also, the logout button is in a different activity.此外,注销按钮处于不同的活动中。

this is what I did to log out.这就是我注销的方法。

FirebaseAuth.getInstance().signOut();

When you try to sign out using the above line of code, it basically means that you are signing out only from Firebase.当您尝试使用上述代码行退出时,基本上意味着您仅从Firebase 退出。

I am using Firebase Google Auth, signing out and logging in again will log in with the last signed account.我正在使用 Firebase Google 身份验证,退出并再次登录将使用上次登录的帐户登录。 How can I make it show the "choose account" dialog?如何让它显示“选择帐户”对话框?

As I see, you are using Google authentication.如我所见,您正在使用 Google 身份验证。 Signing out from Firebase doesn't mean that you are automatically signed out from Google.从 Firebase 退出并不意味着您会自动退出 Google。 It doesn't.它没有。 To sign out from Google you have to explicitly add a call to GoogleSignInClient#signOut() method, like this:要从 Google 注销,您必须显式添加对GoogleSignInClient#signOut()方法的调用,如下所示:

googleSignInClient.signOut();

Please don't forget that the sign-out operation is asynchronous , meaning that you have to wait until the operation completes, which may take some time.请不要忘记注销操作是异步的,这意味着您必须等到操作完成,这可能需要一些时间。 Since this method returns an object of type Task , you can use addOnCompleteListener(OnCompleteListener listener) method, to know when you are completely signed out.由于此方法返回Task类型的 object ,因此您可以使用addOnCompleteListener(OnCompleteListener listener)方法来了解您何时完全退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase 实时数据库注销 Google 帐户 - Firebase Realtime Database Log Out Google Account 如何使用Firebase Auth登出您的Android Studio帐户? - How to log out of your android studio account using Firebase Auth? 如何在 Firebase 中退出我的 Google 帐户,这样当我再次登录时,我可以选择我想登录的帐户? - How do I log out of my Google Account in Firebase such when I log in again, I can choose the account I would like to sign in with? 用户注销并再次登录后,Firebase Facebook登录错误将您登录到应用程序 - Firebase facebook login error logging you into the application after user log out and login again Google 登录 Firebase 身份验证,显示“选择帐户” - Google sign in Firebase auth, show “choose account” 如何从Android中的谷歌帐户注销? - How to log out from google account in android ? com.google.firebase.auth.FirebaseAuthException:Firebase ID令牌未由有效的公钥签名 - com.google.firebase.auth.FirebaseAuthException: Firebase ID token isn't signed by a valid public key Firebase Google Auth错误 - Firebase Google Auth Error 谷歌云日志记录的日志格式 - Log format for google cloud logging 尝试创建帐户时发生 Firebase 身份验证错误 - Firebase Auth Error While Trying To Create An Account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM