0
votes

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 is, when i'm not connected, click "Login", and login, there are 2 events. However the first one 1 the logout event. Why is that?

1
I see the same. Very poorly documented ;( I use the auth.authresponseChange to monitor login/out events. Why I'm not sure. In that event you dont need to call getLoginStatus. But one would think that auth.login and auth.logout would do what they say on the tin... - RichieHH

1 Answers

2
votes

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);
        }