2

I'm trying to add additional permission to access friends list in my Android App , there are many resources about old API graph but could not find anything for new API , so I tried to add new permission to array but it didn't work and I got above error.

public void getProfileInformation()
{
    AccessToken token = AccessToken.getCurrentAccessToken();
    LoginManager.getInstance().logInWithPublishPermissions(LoginActivity.this, Arrays.asList(new String[]{"email", "publish_actions", "user_birthday", "user_hometown","read_custom_friendlists"}));

    final GraphRequest request = GraphRequest.newMeRequest(token, new GraphRequest.GraphJSONObjectCallback() {
        @Override
        public void onCompleted(JSONObject object, GraphResponse response) {

            try {
                Log.d("Firstname", object.getString("id"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
            Log.d("Response Friend List", response.toString());

        }
    });
final Bundle parameters = new Bundle();
    parameters.putString("fields", "id, email, picture, birthday");
    parameters.putString("user", "100006601683765");

    GraphRequestAsyncTask graphRequest = new GraphRequest( AccessToken.getCurrentAccessToken(),"/{user-id}/", null , HttpMethod.GET ,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                    parameters.putString("fields", "id, email, picture, birthday");
                    parameters.putString("user", "100006601683765");
                    request.setParameters(parameters);
                    //request.getParameters();
                    request.executeAsync();

                    Log.d("Yasser List",request.getGraphPath());
                }
            }
    ).executeAsync();
}
Nima
  • 1,892
  • 4
  • 24
  • 32
  • Have you looked at this answer by any chance? there is some confusion around what is required to get the userfriends out. http://stackoverflow.com/questions/23417356/facebook-graph-api-v2-0-me-friends-returns-empty-or-only-friends-who-also-u – Robbie Tapping Jun 03 '15 at 03:39
  • yes I did , but the problem is it is not only about getting friend list it gives me same error for adding any new permission. – Nima Jun 03 '15 at 03:43
  • has the facebook app been set to sandbox mode, and/or the app is in production mode with the approval request from facebook being succesful. This kind of permission requires facebook approval. – Robbie Tapping Jun 03 '15 at 03:46
  • yes , I have done all these procedures. – Nima Jun 03 '15 at 04:46
  • LoginManager.getInstance().logInWithReadPermissions(LoginActivity.this, Arrays.asList("public_profile","user_friends","email")); instead of this LoginManager.getInstance().logInWithPublishPermissions(LoginActivity.this, Arrays.asList(new String[]{"email", "publish_actions", "user_birthday", "user_hometown","read_custom_friendlists"})) – Singhak Jun 03 '15 at 07:13
  • after that where you need other permission then you you take where it need – Singhak Jun 03 '15 at 07:14

2 Answers2

9

Graph API v2.3 , Cannot pass a read permission (read_custom_friendlists) to a request for publish authorization

This error means that you cannot pass these permission in

logInWithPublishPermissions

you have use

LoginManager.getInstance().logInWithReadPermissions(instance, Arrays.asList("public_profile","user_friends","email"));

NOT This

LoginManager.getInstance().logInWithPublishPermissions(LoginActivity.this, Arrays.asList(new String[]{"email", "publish_actions", "user_birthday", "user_hometown","read_custom_friendlists"}));
Singhak
  • 8,508
  • 2
  • 31
  • 34
0

The permission 'read_custom_friendlists' seems to be deprecated. See the Facebook documentation for more information.

Roland Lariotte
  • 2,606
  • 1
  • 16
  • 40
Prajwol KC
  • 398
  • 6
  • 13