rob*_*ing 2 javascript facebook-login angularjs firebase angularfire
当用户单击登录按钮时,将调用登录功能:
login: function() {
ref.auth.$authWithOAuthPopup('facebook').then(user.setUser).catch(function(error) {
console.error('Authentication failed: ', error);
});
}
Run Code Online (Sandbox Code Playgroud)
我使用登录按钮来避免弹出窗口阻止程序.
现在,每当用户访问我的网站或刷新页面时,他们都必须单击登录.如果他们之前已经登录过,有没有办法自动/立即登录?这样,如果立即登录失败,我只能提供登录按钮.
使用该$onAuth(fn)方法将允许您在用户登录时触发功能.
auth.$onAuth(function(authData) {
// fires off whenever a user logs in
});
Run Code Online (Sandbox Code Playgroud)
当登录用户刷新页面时,此回调函数仍将启动.
| 归档时间: |
|
| 查看次数: |
1422 次 |
| 最近记录: |