I am using Parse (by Facebook) as my back end services and I have linked Facebook with the existing Parse User.
I am using the following code on an ParseUser linked with Facebook
accessToken = AccessToken.getCurrentAccessToken();
Log.d("Access Token",accessToken.getToken());
new GraphRequest(
accessToken,"/me?fields=first_name,last_name",null,
HttpMethod.GET,
new GraphRequest.Callback(){
public void onCompleted(GraphResponse graphResponse){
if(graphResponse.getError()!=null)
Log.d("Error", graphResponse.getError().toString());
else{
try{
JSONObject jsonObject = graphResponse.getJSONObject();
ParseUser user = ParseUser.getCurrentUser();
user.put("email",jsonObject.getString("email"));
user.saveInBackground();
}catch(JSONException e){
e.printStackTrace();
}
}
}
}
).executeAsync();
Now in my log I am getting an access token which when used at developers.facebook.com/tools/explorer/ -> It works completely fine there
In my log I am getting the following Error -> "{HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: An active access token must be used to query information about the current user.}"
This is totally frustrating. I am using the same token to access my information and it is working completely fine.