Closed (fixed)
Project:
Drupal for Facebook
Version:
6.x-3.x-dev
Component:
Facebook Connect
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Feb 2013 at 16:02 UTC
Updated:
25 Jul 2013 at 17:01 UTC
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
Comment #1
hacmx commentedI 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!
Comment #2
gumol commentedIt works now, thanks.
Comment #3
Dave Cohen commentedI'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.
Comment #4
gumol commentedDave 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)
Comment #5
Dave Cohen commentedI 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)
Comment #6
vflirt commentedHi,
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
Comment #7
mayur.pimple commentedSolution is put logout link in l () function;
l("logout","logout");Comment #8
dfletcher commentedConfirmed, changing to 7.x-3.x-dev from 7.x-3.3-beta6 fixed the click twice logout bug for me.
Comment #9
Dave Cohen commenteddfletcher, 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.
Comment #10
dfletcher commentedDave, 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.
Comment #11
Dave Cohen commentedOh sorry I totally misread what you wrote. Thanks for clearing it up.
Comment #12.0
(not verified) commentedlanguage mistake