0

I had implemented Facebook login integration in my App. Issue is i am getting only name and id in my access token. I know it might be duplicate question but problem is bit different.

In graph response i am getting all the requested parameters . But in access token only name and id.

Graph Api

   Bundle parameters = new Bundle();
            parameters.putString("fields","id,first_name,email,gender,last_name");
            GraphRequest request = new GraphRequest(AccessToken.getCurrentAccessToken(), "/me",parameters,
                    HttpMethod.GET, new GraphRequest.Callback() {
                @Override
                public void onCompleted(GraphResponse response) {
                    Log.v("LoginActivity", response.toString());

                    JSONObject json = response.getJSONObject();
                    System.out.println("Json data :" + json);
                    try {
                        if (json != null) {

                            id = json.getString("id");
                            socialEmail = json.getString("email");
                            gender = json.getString("gender");
//This token returning null
                            AccessToken.refreshCurrentAccessTokenAsync();
                            token = AccessToken.getCurrentAccessToken().getToken();

                            Log.d(TAG, "facebook access token: " + token);
                            updateUserEmail();
                        }
                    } catch (JSONException ex) {
                        ex.printStackTrace();
                    }
                }
            });
    request.executeAsync();

Testing token with following link:

https://graph.facebook.com/me?access_token=token

young_08
  • 1,196
  • 2
  • 13
  • 35

0 Answers0