Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook connect and third-party cookies?

What is the best way to keep the user logged in when something like "third-party" cookies are disabled. I currently have a Facebook connect app (in only PHP) that works great when I have that checked in Firefox, but redirects to my login page when it's unchecked. Even Facebook's own sample application (therunaround) has the same problem with this unchecked so I'm wondering if there's no way around the issue.

Edit:

@codege3k

Tried a bunch of p3p headers. No dice so far. I've got a login page that redirects to my index when the user "connects" ... the first load, I'm able to get the user id from get_loggedin_user() but when I refresh, that function returns null. The cookies exist, and when I go back to the login page and click connect again it doesn't prompt me for a login, so I know it's partly working. With "third-party cookies" turned on in Firefox, it works like a charm.

Edit:

What is the best way to handle facebook connect in the context of a user login then if third party cookies is not widely supported? Should I just use the initial login that works and set a local cookie for my own site and use that instead of checking the facebook status every time?

like image 663
typeoneerror Avatar asked Mar 03 '09 17:03

typeoneerror


1 Answers

Ok, promoting the session seems to work.

$fbUserId = self::$facebook->get_loggedin_user();
if ($fbUserId)
{
     self::$facebook->promote_session();
     return $fbUserId;
}

Edit:

So this gets the session on every request, but essentially, third party cookies must be enabled for Facebook Connect to work as expected. From their docs:

The user's browser must be set to accept 3rd Party Cookies in order for it to stay connected between clicks.

Source: http://wiki.developers.facebook.com/index.php/Logging_In_And_Connecting

like image 101
typeoneerror Avatar answered Sep 23 '22 18:09

typeoneerror