firebasefirebase-authenticationgoogle-smartlockpasswords

Firebase AuthUI Smartlock Cleanup


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
                    );
                }
            }
        };

    }

Solution

  • For me the fix was;

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

    When logging in, and then;

    AuthUI.signOut(context)
    

    When Signing out