在Facebook Graph API上的帮助,返回“false”但UID是公开的 [英] Help on Facebook Graph API, returns "false" but UID is public
问题描述
我真的不明白为什么在某些Facebook对象(更具体的是:用户的帖子)中,当API使用通过OAuth通过应用程序获取的access_token时,Graph API返回false,但不能使用用户access_token。
I really could not understand why on some Facebook objects (being more specific: user posts) the Graph API returns false when using an access_token obtained via OAuth by an application, but NOT by using a user access_token.
我在这里有一个例子:
https:/ /graph.facebook.com/10150158049595775?access_token=XXXXXXXXXX
I have an example here: https://graph.facebook.com/10150158049595775?access_token=XXXXXXXXXX
这篇文章是公开的,我没有这个用户的共同之处。
This post is public, and I have no friends in common with this user.
如果您尝试通过使用通常的Facebook OAuth方案获取的令牌来访问上面的URL,则服务器返回false。
If you try to access the url above by using a token obtained via the usual Facebook OAuth scheme, the server return "false".
如果您使用用户访问令牌,例如FB给您的访问权限,请访问此页面中的示例 http://developers.facebook.com/docs/reference/api/ ,Graph API正确地提供了用户的帖子详细信息。
If you use your user access token, for example the one that FB gives you by visiting the examples in this page http://developers.facebook.com/docs/reference/api/, the Graph API correctly gives you the users's post detail.
我相信这不是需要扩展权限的问题,首先是因为上面的帖子是公开的,其次,因为测试我试图让我的应用程序通过询问所有的用户权限来生成一个令牌(是的,在developers.facebook.com/docs/authentication/permissions/上找到的所有权限),答案总是假。
I believe it's not a matter of extended permissions required, first because the post above is public, and second, because for testing I've tried to make my application generate a token by asking ALL user permissions (yes, all permissions found on developers.facebook.com/docs/authentication/permissions/) and the answer was always "false".
推荐答案
我假设这篇文章是可以在Facebook上的所有人使用,这可能是Facebook正在接受用户的原因 access_token
(即以用户身份查看帖子),而不接受 access_token
的应用程序。
I suppose this post is "Available to everyone on Facebook", which may be the reason why Facebook is accepting a user access_token
(i.e. viewing the post as a user) and not accepting an application access_token
.
另请注意,这将在没有 access_token
(如果您预设所有者ID))下工作:
Also note that this would work without access_token
(if you prepend the owner id):
https://graph.facebook.com/752020774_10150158049595775
我 猜测 被视为可公开访问
这篇关于在Facebook Graph API上的帮助,返回“false”但UID是公开的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!