简体   繁体   中英

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?

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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM