Facebook Authentication in IE not woking

2019-01-29 01:18发布

Im making a facebook canvas app. To get the users info im using the PHP SDK:

 <?

         $app_id = "";
         $secret="";
         $canvas_page = "";
        $auth_url = "";


$facebook = new Facebook(array(
  'appId'  => '',
  'secret' => '',
));

// Get User ID
$user = $facebook->getUser();

if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}

// Login or logout url will be needed depending on current user state.
if ($user) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl();
}

$user = $facebook->api('/me');

?>

Everything works fine in all browsers except on IE (all versions). When I click a link to another page inside the app, i get the next error:

Fatal error: Uncaught OAuthException: An active access token must be used to query
 information about the current user. thrown in 
/hermes/bosoraweb019/b2365/ipg.zicedcom/metrik/fbapp/fb/base_facebook.php on line

The code i just showed is in all pages inside the app, and i only get this problem in IE

Thanks!

1条回答
Evening l夕情丶
2楼-- · 2019-01-29 02:07

It seems that for IE you need to enable 3rth party cookies (p3p). Just changed changed the header with php:

<? header('P3P: CP="NOI ADM DEV PSAi NAV OUR STP IND DEM"'); ?>
查看更多
登录 后发表回答