我正在尝试获取登录用户的 ID 和电子邮件。这是我的代码:
authButton.setReadPermissions(Arrays.asList("basic_info","email"));
// session state call back event
authButton.setSessionStatusCallback(new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
Log.i(TAG,"Access Token"+ session.getAccessToken());
Request.newMeRequest(session,
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,Response response) {
if (response != null) {
Log.i(TAG,"User ID "+ user.getId());
Log.i(TAG,"Email "+ user.asMap().get("email"));
}
}
});
}
}
});
一切顺利,直到这里
Log.i(TAG,"Access Token"+ session.getAccessToken());
我可以看到访问令牌,但onComplete
没有调用该方法,并且我没有得到任何用户信息。
我究竟做错了什么?