简体   繁体   中英

$_SESSION data gets destroyed after Facebook Login

I've implemented a method for users to add their Facebook accounts to their site account. It was working fine until I switched from stage domain to my production domain. (They're hosted on different servers)

I'm redirecting the user to the Login URL as below:

$params = array("redirect_uri" => SITE_URL . "settings/accounts");
$login_url = $facebook->getLoginUrl($params);

In SITE_URL . "settings/accounts" SITE_URL . "settings/accounts" , I check for $_GET["state"], and finish the integration. The problem with the production server is, the $_SESSION now only holds some gibberish (at least, to me) Facebook objects. The user data in $_SESSION is gone, so that I can't bind the facebook_id to his userID.

Am I missing something here?

Thanks.

Facebook returns $_SESSION / $_GET vars as a signed block, and you have to use the PHP SDK to extract them. Try something like this:

$facebook -> getSignedRequest();

Am I missing something here?

Most likely you're missing the fact that your session was not destroyed , but a new one has been created … check that, and if the case, fix the old third party cookies problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM