samedi 18 février 2017

When SignOut from Firebase also need to SignOut from auth provider for example Google

i am using google auth provider to sign in with my app, i called firebase sign out method and redirects it into the login page but when user again click on Google sign in button it automatically authenticate and logged-in into the app. here is the code for sign-in

 $('#GooglePluseLogin').click(function (e) {
        showLoaderPF(true);
        if (!firebase.auth().currentUser) {

            var provider = new firebase.auth.GoogleAuthProvider();
            provider.addScope('http://ift.tt/18tkxUQ');
            firebase.auth().signInWithRedirect(provider);


        } else {
            firebase.auth().signOut();
            showLoaderPF(true);
        }
    });

And, here is the code for signout

firebase.auth().signOut().then(function () {
            debugger;
            localStorage.clear();
            deleteAllCookies();

           // firebase.auth().unauth();

            window.location.href = "index.html";

        }, function (error) {
            showLoaderPF(false);
            console.error('Sign Out Error', error);
        });

Aucun commentaire:

Enregistrer un commentaire