简体   繁体   English

Android Facebook SDK访问令牌问题

[英]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. 然而,facebook返回错误,提示使用上述代码需要活动访问令牌。

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. 您不需要将访问令牌添加到分发包中,因为facebook结构已经具有访问令牌,它将作为请求方法的一部分插入到令牌中。

Try adding the "fields" as part of the Bundle and call a different graph path: 尝试将“字段”添加为Bundle的一部分,并调用其他图形路径:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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