I use this code to check if a user has an open Facebook session and has allowed my app:
window.fbAsyncInit = function() {
FB.init({
appId : 'MY APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
function checkLoginFB() {
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
showLogout();
} else {
// no user session available, someone you dont know
showLogin();
}
});
}
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
}
But no matter what (whether the user is signed in to Facebook AND has allowed my application or not)
I get a null value for response.session. does anyone know why?
The problem here was caused by my having “accept 3rd party cookies’ turned off in my browser.
I had not even thought about this since I didn’t even remember turning them off.