1

I am trying to achieve the following: Read comments on an specific feed

I have:

  • Create an app account
  • Create test users (temporary facebook account)
  • On login I have ask/grant all permissions for that users

Then, I have add a feed with "User A" by doing the following:

//Execute login
function myFacebookLogin() {
    FB.login(function(){}, {scope: 'public_profile,user_friends,email,user_about_me,user_actions.books,user_actions.fitness,user_actions.music,user_actions.news,user_actions.video,user_birthday,user_education_history,user_events,user_games_activity,user_hometown,user_likes,user_location,user_managed_groups,user_photos,user_posts,user_relationships,user_relationship_details,user_religion_politics,user_tagged_places,user_videos,user_website,user_work_history,read_custom_friendlists,read_insights,read_audience_network_insights,read_page_mailboxes,manage_pages,publish_pages,publish_actions,rsvp_event,pages_show_list,pages_manage_cta,pages_manage_leads,ads_read,ads_management'});
}

//Then Post feed
function postOnWall() {
    FB.api(
        '/me/feed',
        'post',
        {message: 'Hello, world!'},
        function (response) {
            console.log(response);
            //object id: 111040869259526_111040872592859
        }
    );
}               

Once I did this I get the object_id code for it. Using facebook add a comment and then check it with "User A" by:

//Execute login
function getComments() {
    FB.api(
        "/111040869259526_111040872592859/comments", //object_id is hardcoded 
        function (response) {
            if (response && !response.error) {
                console.log(response);
            } else {
                console.log(response);
            }
        }
    );
}

As a result I have get the comment on a json response. My problem now, is when trying to read the comments by using another user account. Let's say I logged in with other test account "User B" (Also all privileges granted) and execute the same code to getComments. The result is an empty array

Do you have any idea on what could I be doing wrong?

ekad
  • 14,436
  • 26
  • 44
  • 46
Luciano
  • 11
  • 1
  • Test your request in Graph API Explorer, and see if you get any debug messages. https://developers.facebook.com/tools/explorer – CBroe Nov 05 '15 at 14:54
  • I have test on that tool and tells me ""Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api" Anyway, I am doing the same request (111040869259526_111040872592859/comments) – Luciano Nov 05 '15 at 15:10
  • That usually means that your access token does not include sufficient permission to read the requested content. – CBroe Nov 05 '15 at 15:37
  • @CBroe thanks for the answer... The application is on development mode and I have granted all the privileges to the user... Also users are tester ones. Could it be that the application has not the privileges (publish_actions and user_posts) approved by Facebook? (I thought that this was necessary only on live mode – Luciano Nov 05 '15 at 16:40
  • Are the two test users friends? – CBroe Nov 05 '15 at 17:39
  • No, they are not. But I think that this is not necessary or am I wrong? https://developers.facebook.com/docs/facebook-login/permissions/v2.5#reference-user_posts ==> Provides access to the posts on a person's Timeline. Includes their own posts, posts they are tagged in, and posts other people make on their Timeline. – Luciano Nov 06 '15 at 18:32

0 Answers0