Hi.

I've noticed that when I try to logout (after logging in via Facebook Connect), I have to click twice to logout:
1. First click does nothing on Drupal site, but logs out user on Facebook
2. Second click logout user from Drupal site.

This issue is also on drupalforfacebook.org page.

Any ideas how to solve it?

Comments

hacmx’s picture

I make 2 changes in fb_connect.js that work for me:

// click handler
FB_Connect.logoutHandler = function(event) {
// If we need to reload, go to front page.
Drupal.settings.fb.reload_url = Drupal.settings.fb_connect.front_url;

if (typeof(FB) != 'undefined' && FB.getAuthResponse()) {
try {
FB.logout(function () {
// Logged out of facebook. Session change event will log us out of drupal and
window.location = Drupal.settings.basePath; // first change --add this line
});
// Facebook's invalid cookies persist if third-party cookies disabled.
// Let's try to clean up the mess.
// @TODO: is this still needed with newer oauth SDK???
//FB_JS.deleteCookie('fbs_' + Drupal.settings.fb.apikey, '/', ''); // apikey

if (FB.getUserID()) { // @TODO: still needed with newer oauth SDK???
// Facebook needs more time to log us out. (http://drupal.org/node/1164048)
return false;
}
}
catch (e) {
return false;
}
}
else {
//debugger;//second change -comment this line
return true;
}
};

im sure that can be improved. Cheers!

gumol’s picture

Status: Active » Needs review

It works now, thanks.

Dave Cohen’s picture

Title: Logout only after double click » Logout link must be pressed twice
Priority: Normal » Major

I've pushed more involved fixes to both 6.x and 7.x branches.

Anyone experiencing this this should test the latest .dev build and please confirm whether it fixes it.

The problem comes from a change in Facebook's Javascript SDK. In the past, FB.getUserID() would return empty after logout. Now, it returns their user id as if they hadn't logged out. This bug affects most fb_connect.module users.

Also the first click of logout will actually log the user out. Just not quickly enough. So the page seen after logout looks like they are still logged in. But following another link will be anonymous.

gumol’s picture

Dave Cohen : Where can I find latest dev version? https://drupal.org/node/178857/release here I have latest version from January 17, 2013 at 7:53pm (fb 7.x-3.3-beta6)

Dave Cohen’s picture

I mean the .dev release you can download on https://drupal.org/project/fb

The .dev is the latest code from git repository (and that is the other way to get it)

vflirt’s picture

Hi,

I have tried latest dev release.
The comment problem occurs only on /user page. If i login with facebook and then i browse on the site the logout link works ok but if i am on /user then the first click logs me out of facebook but the page is not realoded for some reason. It is hard to debug cause every breakpoint actually fixes the issue.
I am having one more issue though. I am trying to redirect to a custom page after user login with facebook.
I have used rules for this but with no success.
First i had to fix fb_rules_rules_event_info function to use db_rules as module in the returned array.
But again no success in redirect after login with facebook the /user page is just refreshed.
I would appreciate if anyone could help.

kind regards

mayur.pimple’s picture

Solution is put logout link in l () function;

l("logout","logout");

dfletcher’s picture

Confirmed, changing to 7.x-3.x-dev from 7.x-3.3-beta6 fixed the click twice logout bug for me.

Dave Cohen’s picture

Status: Needs review » Fixed

dfletcher, you mean you downloaded the .dev build a while ago? It's only more current than the other builds if you update occasionally.

I'm going to assume this is fixed. If someone can reproduce on latest build, please let me know.

dfletcher’s picture

Dave, I was just replying to:

> Anyone experiencing this this should test the latest .dev build and please confirm whether it fixes it.

Which indeed fixed it for me. beta6 had the problem, dev did not.

Dave Cohen’s picture

Oh sorry I totally misread what you wrote. Thanks for clearing it up.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

language mistake