How to register a callback for SignOut Event in Firebase Anonymous login?

0

Issue

I am trying to see if its possible to somehow register a callback for onSignOut in firebase?

I am trying to use login users anonymously. I have registered for onAuthStateChanged() but its only fired when you you login. I want a function callback when this login sessions finishes.

OnDisconnect() listener is specifically for the database socket dropping off. But I need a specific way to know if the anonymous login is signed out.

Solution

This is one way you can do it:

firebase.auth().onAuthStateChanged(function(user) {
    if(user)
      {//logged in}
    else
      {//logged out}
  }); 

Answered By – srinivas

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More