My app uses Facebook Login Button of facebook-android-sdk. It was working until last days, now on a graph request on a page's feed
Bundle parameters = new Bundle();
parameters.putString("fields", "id,icon,created_time,name,caption,description,message,link,full_picture,shares");
parameters.putString("limit", "50");
parameters.putString("locale", mLocale);
String pathPosts = path + "/posts";
GraphRequest request = new GraphRequest(
AccessToken.getCurrentAccessToken(), pathPosts, parameters, HttpMethod.GET,
new GraphRequest.Callback() {
@Override
public void onCompleted(
GraphResponse response) {
mResponse = response;
}
});
request.executeAndWait();
I get the OAuthException error
{Response: responseCode: 500, graphObject: null, error: {HttpStatus: 500, errorCode: 1, errorType: OAuthException, errorMessage: An unknown error has occurred.}}
UPDATE Found that with limit lower-equal than 33 it works without errors
parameters.putString("limit", "33");
For another page's feed the limit must be lower-equal than 7 to work without errors
parameters.putString("limit", "7");
Question: what is now the rule for the limit in a graph api request for page's feed?
Facebook Graph API has also got a Debug Mode. You need to pass an extra parameter debug=all in the REST API. It will give you the reason for the issue too in the response JSON if there is any issue.
Quoting Facebook documentation -
When Debug Mode is enabled, Graph API response may contain additional fields that explain potential issues with the request. To enable debug mode, use the debug query string parameter. For example:
GET graph.facebook.com /v2.3/me/friends access_token=...& debug=all
In your code, try changing this
String pathPosts = path + "/posts";
to this
String pathPosts = path + "/posts&debug=all";
Or
Add and an extra parameter "debug" "all" in your Bundle
and check what debug message you got
For more info on handling errors and debugging Graph API, see here - https://developers.facebook.com/docs/graph-api/using-graph-api/#errors
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With