This event is fired when user login
FB.Event.subscribe('auth.login', function(response) {
//
开发者_JAVA技巧 });
But i am just looking for the event that is fired when user allows the app from auth dialog ?
FB.Event.subscribe('auth.authResponseChange', function(response) {
alert('The status of the session is: ' + response.status);
});
auth.authResponseChange - fired when the authResponse changes, so in theory when a user allows the app from the auth dialog this will fire.
from http://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
Also, in the code to prompt the user to allow the app:
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'});
}
});
精彩评论