어제 페이스 북에서 developers roadmap changes을 업데이트했기 때문에 내 사이트에 Facebook 로그인 의존성이 있으므로 심각한 문제가 있습니다.페이스 북의 자바 스크립트 SDK와 PHP SDK가 플랫폼 업데이트 이후처럼 통합되지 않았습니다.
나는 문제가 아래에 나와 내 페이스 북 JS SDK 믿습니다 :
<script type="text/javascript">
(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#xfbml=1&appId=ID";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
var button;
var userInfo;
window.fbAsyncInit = function() {
FB.init({
appId: 'ID', //change the appId to your appId
channelUrl : '//www.DOMAIN.com/channel.html', // Channel File
status: true,
cookie: true,
xfbml: true,
oauth: true});
showLoader(false);
function updateButton(response) {
button = document.getElementById('fb-auth');
userInfo = document.getElementById('user-info');
if (response.authResponse) {
//user is already logged in and connected
FB.api('/me', function(info) {
login(response, info);
});
button.onclick = function() {
FB.logout(function(response) {
logout(response);
});
$.post('scripts/logout.php',{ facebook_id:response.authResponse.userID } , function(data) {
//kill sessions
});
};
} else {
//user is not connected to your app or logged out
button.innerHTML = '';
button.onclick = function() {
showLoader(false);
FB.login(function(response) {
if (response.authResponse) {
FB.api('/me', function(info) {
login(response, info);
});
} else {
//user cancelled login or did not grant authorization
showLoader(false);
}
window.location.href='/user/index.php';
}, {scope:'email,user_birthday,status_update,publish_stream,user_about_me'});
}
FB.Event.subscribe('auth.authResponseChange', function(response) {
if (response.status === 'connected') {
window.top.location = '../user/index.php';
}
});
}
}
// run once with current status and whenever the status changes
FB.getLoginStatus(updateButton);
//FB.Event.subscribe('auth.statusChange', updateButton);
// FB login insert/update
// Additional init code here
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
FB.api('/me', function(info) {
getLoginStatus(response, info);
});
if (response.authResponse.userID) {
$.post('scripts_profile/init.php',{ facebook_id:response.authResponse.userID } , function(data) {
//Good
});
} else {
//Nothing
}
} else if (response.status === 'not_authorized') {
// not_authorized
login();
} else {
// not_logged_in
login();
}
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
내 사이트는 또한 페이스 북 JS SDK와 함께 intergrates 페이스 북 PHP SDK를 가지고있다.
Facebook SDK가 업데이트되면서 JS SDK는 예전과 마찬가지로 inconncistencies를 일으키지 않습니다.
예를 들어, 내 사이트에 사용자가 로그인 한 경우 헤더가 방문자와 다르게 표시됩니다. 그래서 FB PHP SDK에 따라 : 업데이트 이후
if (!my_profile) {
//user header
} else {
//visitor header
}
, 한 번 로그인 한 사용자 A가 자신이해야 ... 그리고 단순히 그것을 방문하여로 볼 수있는 페이지를 새로 고침 할 필요가, 로그인. 링크를 클릭하거나 URL을 입력하여 해당 페이지를 직접 방문하면 즉시 로그 아웃 된 것으로 표시됩니다.
저는 지난 10 시간 동안 작업을하고 있습니다. 귀하의 도움을 매우 높이 평가 될 것입니다!
감사합니다.
이 이제 PHP-SDK의 최신 버전으로 업데이트하여 수정되었습니다. –
정말 고마워요! 문제는 내 base_facebook.php 파일을 최신 업데이트로 업데이트 한 이래 오늘 아침에 v3.2.2 – user946742
+1이 해결되었습니다. 감사 – Enrique