Possible Duplicate:
response.authResponse is null
i have developed one facebook page with apps,
what i want is whenever any user visit my page, the user is served by one popup message, the popup will disappear only when user click “like” button, if user has already liked the page, popup will not appear, to do this i have write following code
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var user_id = response.authResponse.userID;
var page_id = "app_id";
var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id;
var the_query = FB.Data.query(fql_query);
the_query.wait(function(rows) {
if (rows.length == 1 && rows[0].uid == user_id) {
alert("liked the page");
popup.hide() // hide the popup as user has clicked like button
}
else {
alert("not liked ");
}
});
}
else if (response.status === 'not_authorized') {
}
else
{
alert("not logged in");
}
});
the above code works fine with only one FB user, one which is admin of this page, for all other user it returns response.status === 'not_authorized' status, so i’m unable to retrieve the user login information, because in this case i’m getting null response.authResponse
do anyone have any idea, how to check login status for all users, not for admin only…??
thanks.
If you are talking about a page tab app and all you want to know is the “like” status of the visiting user then all you have to do is parse the
signed_requestpassed to your app. You can read more about using and parsing Signed Requests here.In the
signed_requestthere is auserobject – the information you need is in that object.