Facebook中的身份验证不会唤醒 [英] Facebook Authentication in IE not woking

查看:147
本文介绍了Facebook中的身份验证不会唤醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作一个Facebook画布应用程序。要获取使用PHP SDK的用户信息:

 <? 

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


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

//获取用户ID
$ user = $ facebook-> getUser();

if($ user){
try {
//继续知道你有一个登录的用户被认证。
$ user_profile = $ facebook-> api('/ me');
} catch(FacebookApiException $ e){
error_log($ e);
$ user = null;
}
}

//根据当前用户状态,需要登录或注销url。
if($ user){
$ logoutUrl = $ facebook-> getLogoutUrl();
} else {
$ loginUrl = $ facebook-> getLoginUrl();
}

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

?>

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

 致命错误:未捕获OAuthException:活动必须使用访问令牌来查询有关当前用户的
信息。抛在
/hermes/bosoraweb019/b2365/ipg.zicedcom/metrik/fbapp/fb/base_facebook.php行

我刚刚显示的代码在应用程序的所有页面中,我只在IE中得到这个问题



谢谢!

解决方案

似乎对于IE,您需要启用第3方Cookie(p3p)。刚刚改变了标题与php:

 <?标题('P3P:CP =NOI ADM DEV PSAi NAV我们STP IND DEM); ?> 


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!

解决方案

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

这篇关于Facebook中的身份验证不会唤醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆