Sono nuovo nello sviluppo di siti Web con Facebook SDK. Quindi, per favore abbiate pazienza con me.getLoginStatus restituisce sempre not_authorized
Di seguito è riportato il mio semplice codice per verificare che si sia connessi a Facebook. Per qualche motivo ottengo sempre la risposta 'non_autorizzata', anche se sono l'unico sviluppatore della mia app. Il numero dell'app che fornisco è corretto.
<!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'è qualcosa che ho trascurato?
Molto apprezzato :)