これはオプションの権限ですが、キャンバス アプリでスキップすることはできません。この権限で「スキップ」をクリックすると、ページがリダイレクトされ、何度も何度もこの権限を要求されます。なぜこれが起こっているのか誰にも分かりますか?
どうもありがとう!:)
<!-- BEGINNING OF THE INDEX.PHP CODE -->
<?php
//SOLVES INFINITE LOOP ON IE
header('P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
// Enforce https on production
if (substr(AppInfo::getUrl(), 0, 8) != 'https://' && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
header('Location: https://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}
$facebook = new Facebook(array( 'appId' => AppInfo::appID(), 'secret' => AppInfo::appSecret(), ));
$user_id = $facebook->getUser();
//Check if we have an user_id
if ($user_id!="0") {
try {
// Fetch the viewer's basic information
$basic = $facebook->api('/me');
} catch (FacebookApiException $e) {
// If the call fails we check if we still have a user. The user will be
// cleared if the error is because of an invalid accesstoken
if (!$facebook->getUser()) {
header('Location: '. AppInfo::getUrl($_SERVER['REQUEST_URI']));
exit();
}
}
} else {
// If the user is not connected to the application, redirect the user to authentication page
$login_url = $facebook->getLoginUrl(array('redirect_uri' => "https://apps.facebook.com/APP_NAME_SPACE/",'scope' => 'publish_stream,email','display' => 'page'));
?><html xmlns="https://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
</head>
<body>
<script type="text/javascript"> top.location.href='<?php echo $login_url; ?>'</script>
</body>
</html><?php
exit();
}
if(isset($basic)) {
$locale=idx($basic, 'locale');
$name=he(idx($basic, 'name'));
$email=he(idx($basic, 'email'));
} else {
// IF the user is not loggin on facebook, redirect the user to facebook login page
?>
<script type="text/javascript">
var oauth_url = 'https://www.facebook.com/dialog/oauth/';
oauth_url += '?client_id=APP_ID';
oauth_url += '&redirect_uri=' + encodeURIComponent('https://apps.facebook.com/APP_NAME_SPACE/');
oauth_url += '&scope=publish_stream,email'
window.top.location = oauth_url;
</script>
<?php
exit();
//ends execution if there's no login
}
?>
<html>
// APP HTML CODE
</html>