i\'m trying to get Facebook user id using the php sdk like this
$fb = new Facebook\\Facebook([
\'app_id\' => \'11111111111\',
\'app_secret\' =>
you receive this error if you origin hostname is different than the target hostname once authenticated.
$loginUrl = $helper->getLoginUrl('http://MyWebSite', $permissions);
with this statement, if the visitor on your website used http://www.mywebsite.com/ the cross-site error will be raised.
You must ensure that origin and target hostname are exactly the same, including the eventual www prefix.
Fixed version:
$loginUrl = $helper->getLoginUrl('http://'.$_SERVER['SERVER_NAME'], $permissions);