Error in facebook login integration Android

  android, facebook, facebook-graph-api, picasso

i have done all the steps stated in
https://developers.facebook.com/docs/facebook-login/android%20
i am getting the response as well but when i tried to show profile image to an image view i am getting an error like this

GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID ‘3282910721234’ does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}

Can someone help me out?

the code that i have written

loginButton = (LoginButton) findViewById(R.id.login_button);
        loginButton.setPermissions(Arrays.asList(EMAIL,"public_profile,user_gender"));
        // If you are using in a fragment, call loginButton.setFragment(this);

        // Callback registration
        loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                Log.d("InLogin","Successful Login");
                //Picasso.get().load("https://graph.facebook.com/" + loginResult.getAccessToken().getUserId()+ "/picture?type=large").into(image);
                // App code
            }

            @Override
            public void onCancel() {
                // App code
                Log.d("InLogin","Successful Logout");
            }

            @Override
            public void onError(FacebookException exception) {
                // App code
                Log.d("InLogin", "Error Occurred");
            }
        });
    }
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        callbackManager.onActivityResult(requestCode, resultCode, data);
        super.onActivityResult(requestCode, resultCode, data);
        GraphRequest gr = GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
            @Override
            public void onCompleted(JSONObject object, GraphResponse response) {
                if(object != null)
                Log.d("Response",object.toString());
                try {
                       name.setText( object.getString("first_name") + object.getString("last_name") );
                       Log.d("profile",object.getString("id"));
                       String userId = object.getString("id");
                    Picasso.get().load("https://graph.facebook.com/" + userId+ "/picture?type=large").into(image);
                    Log.d("profile1",object.getString("id"));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
        Bundle bd=new Bundle();
        bd.putString("fields","id,first_name,last_name,email,gender");
        gr.setParameters(bd);
        gr.executeAsync();
    }

i want that my profile pic should come along with name
output:

enter image description here

Source: Android Questions

LEAVE A COMMENT