我关注了某些链接,例如:http://code.tutsplus.com/tutorials/how-to-authenticate-your-users-with-facebook-connect--net-12302以及其他许多链接。我从中创建了这个简化的代码。 它没有错误,但问题是登录链接永远不会转为注销。 网址错误是错误= access_denied& error_code = 200& error_description =权限+错误& error_reason = user_denied& code = ..这里有一些长字符串.. 我已将该应用设置为公开,并可供所有用户使用。
<!doctype>
<html>
<head>
<title> Test</title>
</head>
<body>
<?php
include 'libs/facebook.php';
$facebook=new facebook(array(
'appId'=> '###',
'secret'=>'***',
'cookie'=>false
));
$user=$facebook->getUser();
$me=null;
if($user){
try{
$me=$facebook->api('/me');
}
catch(FacebookApiException $e){
echo $e->getMessage();
}
}
if($me){
echo $me;
$logoutUrl=$facebook->getLogoutUrl();
echo "<a href='$logoutUrl'>Logout</a>";
//echo "in log out url";
}
else{
echo "$me";
$loginUrl=$facebook->getLoginUrl();
echo "<a href='$loginUrl'>Login</a>";
// echo "login url";
}
?>
</body>
</html>
答案 0 :(得分:0)
可能有任何理由:
App_id
和App_secret
可能有误。重新检查
在应用设置中检查Site URL
- 是否正确配置了?