I want prevent user to login with the same account from different devises at the same time , so if the user want to login from different device he must log out from the old device first. iam Flutter and using Google Phone auth by firebase.. I tried similar to this code but didn't work for me
firebase.auth().onAuthStateChanged(firebaseUser => {
if(firebaseUser){
// update Newsitems
firebase.database().ref('news').once('value', function(snap){
snap.forEach(snapChild => {
addNewsItemToHTML(snapChild.val(), snapChild.key)
})
})
}
if(!firebaseUser){
document.getElementById('newsitems').innerHTML = '';
document.getElementById('admin').innerHTML = '';
}
});