Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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("[email protected]")){
                        //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
                    );
                }
            }
        };

    }
like image 505
Mahbub Munna Avatar asked Feb 28 '17 07:02

Mahbub Munna


1 Answers

For me the fix was;

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

When logging in, and then;

AuthUI.signOut(context)

When Signing out

like image 66
Ndivhuwo Avatar answered Sep 29 '22 19:09

Ndivhuwo