我正在做一个 facebook 应用程序,它在我的服务器和 url 上运行良好,当我尝试将它集成为“Facebook 上的应用程序”时,它在注销后无法加载或登录。我相信权限范围会带来一些问题。
服务器的网址:http: //veritas.betamass.com
“Facebook 上的应用”端的网址:https ://apps.facebook.com/orientacionveritas/
请注意,如果您在服务器上成功登录,您将能够看到“Favcebook 上的应用程序”,否则您将一无所获。
连接到 facebook 的代码:
if(!isset($_SESSION['user']))
{
//Application Configurations
$app_id = "148133482012457";
$app_secret = "24d0088e17c1dcb33ac6bb424a5d2a5c";
$site_url = "http://veritas.betamass.com/";
try{
include_once "src/facebook.php";
}catch(Exception $e){
error_log($e);
}
// Create our application instance
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,
));
// Get User ID
$user = $facebook->getUser();
$access_token = $facebook->getAccessToken();
$facebook->setAccessToken($access_token);
// We may or may not have this data based
// on whether the user is logged in.
// If we have a $user id here, it means we know
// the user is logged into
// Facebook, but we don�t know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
//print_r($user);
if($user){
// Get logout URL
$logoutUrl = $facebook->getLogoutUrl();
}else{
// Get login URL
$params = array(
'scope' => 'read_stream, publish_stream, email, user_about_me, user_hometown, user_education_history, user_interests',
'redirect_uri' => $site_url,
);
$loginUrl = $facebook->getLoginUrl($params);
/*$loginUrl = $facebook->getLoginUrl(array(
'scope' => 'read_stream, publish_stream, email, user_about_me, user_hometown, user_education_history',
'redirect_uri' => $site_url,
));*/
}