문제는 이제 액세스 토큰 뭔가 내 페이스 북의 응용 프로그램이 Heroku가 실행에 알 수없는 문제가 있습니다. 무엇을 모르니 무엇이 앱에있는 무언가가 내 액세스 토큰을 손상시키는 것처럼 보입니다. 왜냐하면 내가 응용 프로그램에 로그인하려고 시도하고 탐색기를 사용하면 로그 아웃되거나 액세스 토큰이 만료되었다는 메시지가 나타납니다. 하지만 디버깅하면 2 시간 이상 유효합니다. 또한 로그인 한 후에 페이지를 다시로드 할 수 없습니다.
사이트가 계속로드되고 계속해서 업데이트됩니다. 페이지에 로그인하면 중지됩니다.
최근에 오류가 발생했습니다. 지난 주에는 없었습니다. 문제를 추측하는 Im는 여기 어딘가에있을 것입니다, 그러나 나는 그것을 발견 할 수 없습니다. 문제를 일으킬 수있는 것이 있으면 힌트를 주시기 바랍니다. 감사합니다
require_once('sdk/src/facebook.php');
$facebook = new Facebook(array(
'appId' => AppInfo::appID(),
'secret' => AppInfo::appSecret(),
'sharedSession' => true,
'trustForwarded' => true,
));
$user_id = $facebook->getUser();
if ($user_id) {
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();
}
}
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo AppInfo::appID(); ?>', // App ID
channelUrl : '//<?php echo $_SERVER["HTTP_HOST"]; ?>/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(function(response) {
console.log (response.status);
//this is useful if you want to avoid the infinite loop bug
//it only reloads page when you log in
if (response.status != 'connected') {
FB.Event.subscribe('auth.login', function(response) {
// We want to reload the page now so PHP can read the cookie that the
// Javascript SDK sat. But we don't want to use
// window.location.reload() because if this is in a canvas there was a
// post made to this page and a reload will trigger a message to the
// user asking if they want to send data again.
window.location = window.location;
//Im using the window.location.reload()
//window.location.reload();
});
}
});
FB.Canvas.setAutoGrow();
};
// Load the SDK Asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<header class="clearfix">
<?php if (isset($basic)) { ?>
<p id="picture" style="background-image: url(https://graph.facebook.com/<?php echo he($user_id); ?>/picture?type=normal)"></p>
<div>
<h1>Welcome, <strong><?php echo he(idx($basic, 'name')); ?></strong></h1>
<p class="tagline">
This is your new app for sorting events
<a href="<?php echo he(idx($app_info, 'link'));?>" target="_top"><?php echo he($app_name); ?></a>
</p>
<div id="share-app">
<p>Share this app:</p>
<ul>
<li>
<a href="#" class="facebook-button" id="postToWall" data-url="<?php echo AppInfo::getUrl(); ?>">
<span class="plus">Post to Wall</span>
</a>
</li>
<li>
<a href="#" class="facebook-button speech-bubble" id="sendToFriends" data-url="<?php echo AppInfo::getUrl(); ?>">
<span class="speech-bubble">Send Message</span>
</a>
</li>
<li>
<a href="#" class="facebook-button apprequests" id="sendRequest" data-message="Prøv den her">
<span class="apprequests">Send Requests</span>
</a>
</li>
</ul>
</div>
</div>
<?php } else { ?>
<div>
<h1>Welcome</h1>
<div class="fb-login-button" data-scope="user_likes,user_photos,user_events,friends_events, user_hometown,user_location,user_interests,user_about_me,user_education_history,friends_location,read_friendlists"></div>
</div>
<?php } ?>
</header>
<section id="get-started">
<?php
//echo (idx($app_get_events[1], 'id');
?>
</section>
안녕하세요, 저는 w7에서 firefox를 사용합니다 : – user1748254
및 세션은 어떻습니까? 제대로 작동하고 있습니까? 쿠키를 만들 수 있습니까? –
확인 방법을 잘 모르겠습니다. Mark :/다른 쿠키를 설정하려고하거나 그냥 print_r을 시도해야합니까? – user1748254