Topic-icon Auto Login Facebook Users not working

Active Subscriptions:

None
12 years 3 days ago #21861 by guygoo
Thanks Alex for the explanation.

"Auto Login Facebook Users - If you've used JFBConnect to connect your Facebook account to a Joomla user on your site, this option takes effect. It works if 1) you are not logged into your website currently but you 2) are logged into Facebook.com. After logging in at Facebook.com, if you visit your site, you should be automatically logged in."

From what I understand this does not work for me . I have both radio buttons set to Yes

What happens when you test it, does it work for you?

Cheers, Guy
The topic has been locked.
Support Specialist
12 years 2 days ago #21880 by alzander
Guy,
Yes, the auto login functionality is working for me. Here's how I tested:
* Be logged out of Facebook.com
* Be logged out of your site
* Open your site in a tab. You should see that you are logged out.
* In another tab, go to Facebook.com. You should get the standard "Login" view
* Log yourself in with the account that you've used to create an account on your site with
* Go back to your site tab, and simply refresh the window. You should be logged in.

That's the way to test. Obviously, that's not what all users have to do. Basically, if they visit your site and aren't already logged into it, but are logged into Facebook with an account that is registered on your site, they should be automatically logged in.

Hope that helps, but if you're not seeing the same, let me know!
Alex
The topic has been locked.
Active Subscriptions:

None
12 years 2 days ago #21887 by guygoo
Hi Alex,

You are doing a wonderful job explaining and I believe I understand. It's a really nice attribute.
I've tested with different accounts and browsers and it does not work in the way you have described.
Where do we go from here? Do you need access?

Cheers!
The topic has been locked.
Active Subscriptions:

None
12 years 2 days ago #21892 by guygoo
Hi Alex,

I've experimented using different browsers and computers and now see at least part of the problem. It would appear there's a mis mash with the cookies.

Here's what I did.

In Opera cleared all cookies to be on the safe side.
Logged into Facebook.com using the usual login pain.
Surfed to site using an account associated with FB authentication.
And yes the user was logged in automatically :)

I now logout of the site.
I logout of FB using their site logout.
Login using FB site and login pain and it's set Not to keep me logged in.
Open new window go to test site or refresh existing page and it does not login automatically.
Clear fbsr cookie for example, refresh page and it logs in automatically.

Now you know better which cookies do what and there's obviously some mis-massing going on here.

I can however confirm this appears to be a cookie related issue and hope this information helps you.

Cheers!
The topic has been locked.
Support Specialist
12 years 1 day ago #21927 by alzander
Guy,
Good sleuthing! JFBConnect only detects the initial setting of the fbsr cookie you found. There's a trigger in Facebook's Javascript library which basically says "When you set the fbsr cookie, call this code". That function then calls JFBConnect to try and log the user in. If the fbsr cookie isn't being properly destroyed when a user logs out, then Facebook won't have to replace that cookie later on.. and therefore, the trigger won't be called.

Can you try the following:
1) After you logout of Facebook and -before- you log back in, refresh your page. That will have the FB Javascript library detect that you are logged out and delete the fbsr cookie. If you don't do this, then the fbsr cookie will still be on your site when you logout and log back in on FB (without doing anything on your site for that change to be noticed).
2) Test in Firefox, Chrome, or IE. Those are much more popular browsers. Opera, unfortunately, doesn't get as much love from Facebook, so it's possible the cookie isn't being deleted properly there.

Hope that makes sense. I really think it's your testing method that's causing the problems. It's not a normal 'real world' case.. just one that's run into when you're testing your own site. Hopefully, that's all.

Let us know!
Alex
The topic has been locked.
Active Subscriptions:

None
12 years 1 day ago #21941 by guygoo
Hi Alex,

I too wish it was the testing method and there's nothing wrong. However the long and short of it is, it's really not working as it should.

I tested many different browsers and even on two different computers and the fact it's not dealing with the cookies properly.

I've completely cleared the browser cache and cookies and it's the same result, works once then it stops working, delete the cookies and it works once and then nothing...

I've done about everything possible apart from doing a fresh install... ???

Cheers!
The topic has been locked.
Active Subscriptions:

None
12 years 23 hours ago #21954 by guygoo
Hi Alex,

As you understand I'm stuck on this issue right now. I'd of course like to have it working. I guess it's not going to be easy to fix if you are not sure it's a real problem? Is there anything else I can do?

As you know I had to fiddle to install the update and I'm using both FB and LI. Is there any possibility that "something" has not installed correctly?

Cheers.
The topic has been locked.
Support Specialist
12 years 21 hours ago #21976 by alzander
Guy,
Don't worry, we're not letting this rest. I just did some more testing, and would like you to try making a quick modification to a file in JFBConnect to see if it makes a difference. In the /plugins/system/jfbcsystem/jfbcsystem.php file, at about line 195, you'll see the following block of code:
if ($this->configModel->getSetting('facebook_auto_login') && $guest)
        {
            $status = 'status: true,';
            // get Event Notification subscriptions
            $subs = "\nFB.Event.subscribe('auth.login', function(response) {jfbc.login.on_login();});";
        }
Please change that to (see the comments next to each line):
if ($this->configModel->getSetting('facebook_auto_login')) // Remove '&& $guest'
        {
            $status = 'status: true,';
            // get Event Notification subscriptions
            if ($guest) // Add this line
                $subs = "\nFB.Event.subscribe('auth.login', function(response) {jfbc.login.on_login();});";
        }
This hasn't been tested. It may (or may not) fix your issue and it's possible it may cause other issues, but your feedback will be very helpful in understanding the problem more, and determining a final solution.

The change basically instructs Facebook to update your Cookie at all times, regardless of whether you're logged in. Before this change, it would only update your cookie when you are logged out, and it's possible that meant the cookie wouldn't be deleted in some cases. Hopefully, the code above will fix that, but again, please let us know. We'll do more testing with this code in a few days if we don't hear from you as well.

Thanks,
Alex
The topic has been locked.
Support Specialist
12 years 21 hours ago #21977 by alzander
Oh yeah, a fresh install likely wouldn't have any effect. It seems like it's more of a logic issue that a failed/incorrect installation. That, in our opinion, is usually the last resort. While re-installing is frankly dead-simple, it's over-recommended as a solution, and generally, we feel it's usually just recommended as a way to push off 'real' support to figure out the cause of a problem. Just our philosophy :D

Alex
The topic has been locked.
Active Subscriptions:

None
12 years 11 hours ago #21991 by guygoo
Hi Alex,

Thank you for your code. I tested it and it did not work. You pointed this out so no problem. In actual fact it did break a module I'm using "Facebook Friends".

If possible and in future would you be so kind as to forward the complete file with changes. It's not because I'm lazy, it's to rule out any errors I may make and a little more efficient :)

Cheers
The topic has been locked.