I'm testing the connect function of Facebook. So o'm now using the example of php-sdk + js-sdk.
There are 2 event callbacks, auth.login and auth.logout and both do a reload. But the thing 开发者_如何学JAVAis, when i'm not connected, click "Login", and login, there are 2 events. However the first one 1 the logout event. Why is that?
This is a bit of irritation and not sure why Facebook would implement it in this way. However, I am using a workaround to get past the 'auth.logout' event during user login time while still managing to do what I want to do on 'auth.logout'. Here is the code snippet -
if (response.status === 'connected') {
// This block would be executed during user login
// so, depending on your logic, you may choose to do nothing here
} else {
// This block would be executed during user logout
// implement your intended logic here
// e.g. destroyUserSession(response);
}
精彩评论