打开“Feed”对话框时如何获取用户的名字而无需访问令牌?

时间:2012-01-10 18:54:19

标签: javascript facebook facebook-graph-api

根据documentation,您可以获得一些没有访问令牌的用户数据。当我尝试这个时:

FB.api('/me', function(response) {
  console.log(response);
});

我得到以下对象:

{ error: {
    message: "An active access token ...about the current user.",
    type: "OAuthException"
} }

怎么了?提前谢谢。

1 个答案:

答案 0 :(得分:2)

我在其他源代码中结束“发现”(因为它不在文档中),您可以使用名为{*actor*}的占位符。 它以这种方式工作:

FB.ui({
  method: 'feed',
  link: '<? echo $app['url'] ?>',
  name: $poll.find('.pollQuestionContainer .pollQuestion').text(),
  caption: '{*actor*} answered ' + selected_answer,
  description: 'TV Channel',
  properties: answers
});
相关问题