7

In Firebase, I am using AuthUI for Sign In. I tried FirebaseAuth.getInstance.signout() to remove the current user credentials, but I think maybe for Google SmartLock credentials, it's not signing out. Help me out.

My Code:

mAuthStateListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser user = firebaseAuth.getCurrentUser();

                if (user != null){

                    if (user.getEmail().equals("example@gmail.com")){
                        //Codes to implement

                    } else {
                        FirebaseAuth.getInstance().signOut();

                    }

                } else {
                    startActivityForResult(
                            AuthUI.getInstance()
                            .createSignInIntentBuilder()
                            .setIsSmartLockEnabled(false)
                            .setProviders(Arrays.asList(
                                    new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()))
                            .build(), RC_SIGN_IN
                    );
                }
            }
        };

    }
AL.
  • 36,815
  • 10
  • 142
  • 281
Mahbub Munna
  • 117
  • 1
  • 1
  • 6

1 Answers1

2

For me the fix was;

AuthUI.getInstance().setIsSmartLockEnabled(false)...

When logging in, and then;

AuthUI.signOut(context)

When Signing out

Ndivhuwo
  • 280
  • 2
  • 10