Tôi mới phát triển các trang web bằng Facebook SDK. Vì vậy, hãy chịu với tôi.getLoginStatus luôn trả về not_authorized
Dưới đây là mã đơn giản của tôi để xác minh rằng tôi đã đăng nhập vào Facebook. Vì một lý do nào đó, tôi luôn nhận được phản hồi 'not_autherized', mặc dù tôi là nhà phát triển ứng dụng duy nhất của tôi. Số ứng dụng tôi cung cấp là chính xác.
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'censored app id', // App ID from the app dashboard
status : true, // Check Facebook Login status
cookies : true,
xfbml : true // Look for social plugins on the page
});
FB.getLoginStatus(checkLoginStatus);
function checkLoginStatus(response) {
if (response && response == 'connected') {
alert('User is authorized!');
} else {
alert('User not authorized!!!');
}
};
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK asynchronously
(function(d, s, id) {
if (d.getElementById(id)) return;
var js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js";
var fjs = d.getElementsByTagName(s)[0];
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
</body>
</html>
Có điều gì tôi đã bỏ qua không?
Được đánh giá cao :)