9
I'm using Facebook's JavaScript SDK and trying to determine if the user is logged in or not, I have the following code:
window.fbAsyncInit = function() {
FB.init({
appId:'139894666087975', cookie:true, status:true, xfbml:true
});
$('.login_fb').click(function(){
FB.login(function(response) {
if(response.session)
{
if (response.perms) {
window.location.reload();
}
}
},{perms:'email,user_birthday,user_hometown,user_location,publish_stream'});
});
FB.getLoginStatus(function(response) {
alert(response.authResponse);
if (response.authResponse) {
alert(response.authResponse);
} else {
$.blockUI({
message: $('#fblogin'),
css: {
top: '9%',
left: ($(window).width() - 700) /2 + 'px',
width: '700px',
cursor: 'hand',
border: '10px solid #ccc',
}
});
}
});
};
The response.AuthResponse for getLoginStatus is 'undefined', but I am actually logged in with permissions set for this app.
Any idea why it would continue to show as undefined? When I try to login again, it just closes the Facebook box (because I'm already logged in) and refreshes the page, again showing 'undefined'.
Thanks for any help!