php – IE中的Facebook身份验证不会激活
作者:互联网
我正在制作一个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中遇到此问题
谢谢!
解决方法:
似乎对于IE,您需要启用3rth聚会cookie(p3p).刚刚更改了用php更改了标题:
<? header('P3P: CP="NOI ADM DEV PSAi NAV OUR STP IND DEM"'); ?>
标签:php,facebook,internet-explorer,facebook-php-sdk 来源: https://codeday.me/bug/20191003/1847287.html