I am using Firebase Google Auth, signing out and logging in again will log in with last signed account. How can I make account chooser every time?
Firebase Auth Quickstart sample code provides the following few steps for sign out
Declare Globally these two variables
private GoogleSignInClient mGoogleSignInClient;
private GoogleSignInOptions gso;
Add these lines in onCreate method
gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
Now for signOut
private void signOut() {
// Firebase sign out
mAuth.signOut();
// Google sign out
mGoogleSignInClient.signOut().addOnCompleteListener(this,
new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
updateUI(null);
}
});
}
It's easy, and it will work. Cheers!