Search code examples
androidfacebookfacebook-graph-apiaccess-token

Android Facebook SDK access tokens issue


Bundle bundle = new Bundle();
bundle.putString("access_token", facebook.getAccessToken() );
Log.i("access_token", facebook.getAccessToken());
String response = facebook.request("me/friends?fields=name",bundle, "GET");

The Log line is working fine, so clearly there is an access token there. Furthermore, going to

https://graph.facebook.com/me/friends?fields=name&access_token=1234567.....

works perfectly.

Yet facebook returns with a error saying an active access token is needed using the code above.

Any ideas?


Solution

  • You dont need to add the access token to the bundle, as the facebook structure already has it and it will insert it as part of the request method.

    Try adding the "fields" as part of the Bundle and call a different graph path:

    bundle.putString("fields", "name");
    String response = facebook.request("me/friends",bundle, "GET");