angularjs - firebase logout method has no callback? -
i'm looking @ doc: https://www.firebase.com/docs/security/simple-login-overview.html , based on doesn't logout doesn't accept callback. tried passing 1 , got response accepts 0 arguments. there way confirm logout successful?
on same page, there section titled "monitoring user authentication state" mentions callback pass firebasesimplelogin
constructor function "invoked time user's authentication state changed."
the first parameter (error
) non-null if there error user logging in; second parameter (user
) non-null if user logged in; , both null if user not logged in.
here's example page:
var chatref = new firebase('https://samplechat.firebaseio-demo.com'); var auth = new firebasesimplelogin(chatref, function(error, user) { if (error) { // error occurred while attempting login console.log(error); } else if (user) { // user authenticated firebase console.log('user id: ' + user.id + ', provider: ' + user.provider); } else { // user logged out } });
it's worth noting function called once when object created if user not logged in (e.g., check see if user authenticated right away, , if aren't, call callback null
both values, if had logged out).
Comments
Post a Comment