2010-12-22 53 views
0

我有一个user object,但它的唯一属性是education, first_name, id, last_name, link, locale, location, name, timezone, updated_time, verified。不仅缺少应该公开的属性(如picture),而且这些值与文档(updated_time vs last_updated)不同。最后,奇怪的是,我从文档页面上的链接(here)获得了同样的结果。最终,我试图获得user.feedFacebook API - 返回奇怪值的用户对象

任何想法正在发生什么将不胜感激。我错过了明显的东西吗?

来访https://graph.facebook.com/me/feed给出以下:

{ “错误”:{ “类型”: “OAuthException”, “消息”:“一种主动访问令牌必须被用来查询 信息关于当前用户。“
}}

为什么我需要一个有效的访问令牌? the docspicturefeed是公开的!

这是代码。该user对象被记录到Firebug.console:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> 
<head> 
<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script> 
<script type="text/javascript"> 
function update_user_box() { 
var user_box = document.getElementById("user"); 
FB.api('/me', function(user) { 
user_box.innerHTML = "<fb:profile-pic uid=\"loggedinuser\" useyou=\"false\"></fb:profile-pic>" 
+ "Hey " + user.first_name + "<br>"; 
FB.XFBML.parse(); 
console.log(user); 
}); 
} 
</script> 
</head> 
<body> 


<div id='user'><fb:login-button onlogin="update_user_box();"></fb:login-button></div> 
<br><br> 

<div id="fb-root"></div> 
<script> 
FB.init({ 
appId : 'b07e858317c9069d450023b7500b4511', 
status : true, // check login status 
cookie : true, // enable cookies to allow the server to access the session 
xfbml : true // parse XFBML 
}); 
FB.getLoginStatus(function(response) { 
if (response.session) { 
update_user_box(); 
} else { 
// no user session available, someone you dont know 
} 
}); 
</script> 
</body> 
</html> 
+0

尝试用用户名或ID`https://graph.facebook.com/{ID @用户名} /饲料/`得到 – haha 2010-12-22 22:09:37

+0

你每次你想要API提供数据作为JSON对象时都需要access_token。我认为你对公共饲料是正确的。你可以尝试像这样手动https://graph.facebook.com/me/feed?access_token={YOUR_ACCESS_TOKEN} – Nishant 2010-12-22 22:16:39

+0

@haha是的工作。 https://graph.facebook。COM/ID_OR_USER_NAME /饲料 – Nishant 2010-12-22 22:19:29

回答

1

有一对夫妇的事情,你可以尝试

  • 检查,如果该数据与https://graph.facebook.com/ {YOUR_FB_ID}
  • 正确匹配是没有任何数据(为空)需要扩展权限。 here
  • 您是否使用正确的auth_token和OAuth2.0的

我希望这会帮助你调试见。


编辑:

我们面临这里我们使用的是旧的API(FB-CONNECT),并试图让扩展权限提到的数据有问题。我们无法 - 出于某种原因。我们切换到oAuth2.0,它工作。 #3子弹只是为了分享我的经验。

此外,对于照片,从http://graph.facebook.com/我们刚刚获取的数据{USER_ID} /图片