How to check liked fan page from iframe apps via Graph API and Javascript-SDK
Here is my code开发者_C百科, this is working fine only on apps developer account. WT is my wrong?
window.fbAsyncInit = function() {
var APP_ID = 'XXXXX';
var PAGE_ID = 'XXXXX';
FB.init({
appId : APP_ID,
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
});
FB.api('/me/likes/' + PAGE_ID, function(response) {
t = $.toJSON(response);
alert(t);
});
}
RESULT
developer account:{"data":[{"name":"111222333","category":"Small business","id":"281428705206834","created_time":"2011-09-02T14:14:37+0000"}]}
non-developer account:
{"error":{"type":"OAuthException","message":"An active access token must be used to query information about the current user."}}
It might have something to do with the page settings. If the page is set to be invisible, as in only visible for the administrators of that page, that could be a cause why you are getting that error.
Have you set your page available for everyone?
In order to see a user likes with graph api you will need the permissions to do so. user_likes
See: http://developers.facebook.com/docs/reference/api/permissions/
精彩评论