Facebook Authentication in IE not woking

霸气de小男生 提交于 2020-01-10 05:54:25

问题


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:


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"'); ?>


来源:https://stackoverflow.com/questions/10724908/facebook-authentication-in-ie-not-woking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!