IE中的Facebook身份验证无效

时间:2012-05-23 17:25:19

标签: php facebook internet-explorer facebook-php-sdk

我正在制作一个Facebook画布应用程序。要使用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');

?>

除IE(所有版本)外,所有浏览器都能正常运行。当我点击应用程序内其他页面的链接时,我收到下一个错误:

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

我刚刚展示的代码在应用程序内的所有页面中,我只在IE中遇到此问题

谢谢!

1 个答案:

答案 0 :(得分:7)

似乎对于IE,您需要启用3rth派对cookie(p3p)。刚刚更改了用php更改标题:

<? header('P3P: CP="NOI ADM DEV PSAi NAV OUR STP IND DEM"'); ?>