用户登录时会触发此事件
FB.Event.subscribe('auth.login', function(response) {
//
});
但我只是在寻找当用户从auth对话框中启用应用程序时触发的事件?
答案 0 :(得分:0)
FB.Event.subscribe('auth.authResponseChange', function(response) {
alert('The status of the session is: ' + response.status);
});
auth.authResponseChange - 在authResponse更改时触发,因此理论上当用户允许来自auth对话框的应用程序时,这将触发。
来自http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
此外,在提示用户允许该应用的代码中:
FB.getLoginStatus(function(response) {
if (response.authResponse) {
// logged in and connected user, someone you know
} else {
// no user session available, someone you dont know
FB.login(function(response) {
if (response.authResponse) {
console.log(reponse);
// here will be all the response details from confirmed app
} else {
console.log('User cancelled login or did not fully authorize.');
}
}, {scope: 'email'});
}
});