2

Code that I had written to fetch a Facebook page's posts using an app access token has suddenly stopped working. The JSON response's data object is an empty array. I'm not getting any error messages. When I try making the same request using an access token generated by the Graph API explorer, I get back a valid JSON response containing data. I've tried resetting my app's secret and generating a new access token, but I still get back an empty data object.

When I use the Facebook access token debugger, the only information returned is the App ID.

I generated my app access token by making a GET request to https://graph.facebook.com/oauth/access_token?client_id=<app_id>&client_secret=<app_secret>&grant_type=client_credentials

I don't have control over the page I'm trying to fetch data from, but I can contact the admin. Are there any permissions I should have them check?

Without any error messages or feedback, I'm at a loss on how to debug this. Does anyone have any advice?

4

1 回答 1

1

这完美地工作。

演示

token = 'valid_access_token';
page = '20531316728';
url = 'https://graph.facebook.com/'+page+'/feed?access_token="+token+"&fields=id,message&limit=10';
    comments = [];
$.ajax({
    'async': false,
    'url': url,
    'dataType': "json",
    'success': function (data) {
      $('.result').html(JSON.stringify(data));
    },
    'error': function(data){
      $('.result').html(JSON.stringify(data));
    }
});
于 2014-04-15T21:16:20.913 回答