No permission to access invitable friends

2019-09-06 07:04发布

问题:

I am developing an android game app and want to get a list of Facebook invitable friends.

Unfortunately I hit this error: Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 100, errorType: OAuthException, errorMessage: (#100) No permission to access invitable_friends.} with code below.

Code

new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/invitable_friends",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback()
    {
         @Override
         public void onCompleted(GraphResponse response)
         {
             System.out.println(response);
         }
     }
).executeAsync();

Permissions

List< String> permissionNeeds = Arrays.asList("user_friends");

Can anyone helps me to point out the problems ? Is it caused by missing permission ? Or, I can only get invitable_friends for my game app with Canvas implemenation ?

Thank You. :)

回答1:

Getting user_friends permission requires you to submit your app for facebook devs to review. If you just want the list of friends who have installed your app you can get that without the user_friends permission, by just doing a get call on :

https://graph.facebook.com/fb_id/friends?access_token=...

Reference : https://developers.facebook.com/docs/graph-api/reference/user/friends