javascript - immediate mode automatic login with firebase -
when user clicks login button login function called:
login: function() { ref.auth.$authwithoauthpopup('facebook').then(user.setuser).catch(function(error) { console.error('authentication failed: ', error); }); }
i use login button avoid popup blockers.
now everytime user visits site or refreshes page, have click login. there way of logging them in automatically / if have logged in before? way present login button if immediate login fails.
using $onauth(fn)
method allow fire off function when user has logged in.
auth.$onauth(function(authdata) { // fires off whenever user logs in });
this callback function still fire off when logged in user refreshes page.
Comments
Post a Comment