[英]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.