Graph API v2.3,无法将读取权限(read_custom_friendlists)传递给发布授权请求

时间:2015-06-03 03:22:01

标签: android facebook facebook-graph-api facebook-android-sdk facebook-access-token

我正在尝试添加其他权限以访问我的Android应用中的好友列表,有很多关于旧API图的资源但找不到任何新API,所以我尝试向阵列添加新权限但它没有'工作,我得到了上述错误。

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();
}

2 个答案:

答案 0 :(得分:9)

  

Graph API v2.3,无法传递读取权限   (read_custom_friendlists)发布授权请求

此错误表示您无法在

中传递这些权限
  

logInWithPublishPermissions

你有使用

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

不是这个

LoginManager.getInstance().logInWithPublishPermissions(LoginActivity.this, Arrays.asList(new String[]{"email", "publish_actions", "user_birthday", "user_hometown","read_custom_friendlists"}));

答案 1 :(得分:0)

权限“ read_custom_friendlists”似乎已被弃用。有关更多信息,请参见Facebook documentation