【发布时间】:2016-01-24 11:15:02
【问题描述】:
我无法使用 Facebook sdk 获取完整的用户个人资料。我正在尝试参考以下链接从 Facebook 的图形 API 中检索用户节点。我只收到几个字段(有点像有限的个人资料)
https://developers.facebook.com/docs/graph-api/reference/user
我首先使用以下行进行登录。
LoginManager.getInstance().logInWithReadPermissions(getActivity(), Arrays.asList("public_profile", "user_friends"));
一旦我有了访问令牌,我就会调用“/me”端点。我得到了相应用户的 Facebook 用户 ID。使用此 ID,然后我使用以下代码调用“/{user-id}”端点。
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/" + userProfile.getId(),
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
Log.d(TAG, response.getRawResponse());
}
}
).executeAsync();
但是,返回的字段是有限的,并且不包含下面链接中提到的完整字段集。
https://developers.facebook.com/docs/graph-api/reference/user
我如何检索与用户相关的完整数据集,包括上面链接中提到的朋友列表、年龄等?
我只能检索 id、email、first_name、gender、last_name、link、locale、name、timezone 和经过验证的字段,目前。
【问题讨论】:
标签: android facebook facebook-graph-api