I'm using Firebase authentication with google accounts in my website. Login process works fine, but I have a problem with logout. Everything seems fine when user clicks "logout" button, but when "login" button is clicked again, after logout, the previously signed in user is loged in automaticaly - no prompt for credentials. That happens even in incognito mode.
This is the code i'm using for login and logout, the functions are called on click of login/logout buttons, All the communication with Firebase services happens here:
function login() {
firebase.initializeApp(settings);
var provider = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithPopup(provider).then(function(result) {
var token = result.credential.accessToken;
sessionStorage.setItem('tokenK', token);
var user = result.user;
sessionStorage.setItem('displayName', displayName);
sessionStorage.setItem('userName', user.email);
}).catch(function(error) {
var errorCode = error.code;
var errorMessage = error.message;
var email = error.email;
var credential = error.credential;
});
}
function logOut(){ firebase.initializeApp(settings); firebase.auth().signOut().then(function() { sessionStorage.removeItem('tokenK'); sessionStorage.removeItem('displayName'); sessionStorage.removeItem('userName'); window.open('index.html', '_self'); }).catch(function(error) { console.log(error); }); }
--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/fa621acb-e036-4920-bb11-5adf08190f21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/fa621acb-e036-4920-bb11-5adf08190f21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/a02c86d9-c53d-4b8c-b07d-ae46ee7e3aa8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.