使用Facebook Graph API v2.0访问用户供稿 [英] Accessing user feed using Facebook Graph API v2.0

查看:98
本文介绍了使用Facebook Graph API v2.0访问用户供稿的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Facebook中创建了一个应用.默认情况下,使用的API版本为v2.0.因此,对于每个新用户,它都会生成一个应用程序范围内的用户ID".我正在通过图形API搜索功能检索用户ID.

I recently created an app in Facebook. By default the API version used was v2.0. Thus for every new user it generated a 'App-scoped User ID'. I am retrieving the ids of users through the graph api search feature.

现在,我想使用/{user-id}/feed获取特定用户的feed.

Now I want to use the /{user-id}/feed to fetch feed of a specific user.

是否可以使用通过Facebook应用程序为我的Facebook帐户生成的访问令牌访问特定用户的供稿?

Is there a way I can access a specific user's feed using an access token generated for my Facebook account through a Facebook app?

推荐答案

页面用户是另一回事.对于页面,如果帖子不受限制(年龄,性别等),则可以使用App Access Token轻松访问 PAGE_ID/Feed .如果帖子受限制,则必须使用用户访问令牌来访问此帖子.

Page and User is different thing. For page, you can access PAGE_ID/feed easily with App Access Token if this post is not restriced (age, gender...etc).If the post is restricted, then you must use User access token to access this posts.

对于用户而言,故事是不同的,Facebook在用户源上非常严格.因此,您必须使用用户访问令牌来获取 User_ID/Feed .

For user is different story, Facebook is very strict on user feed. So you must use User access token to get User_ID/feed.

我建议你那样做:

  1. 如果该用户是您的应用程序用户,具有 read_stream 权限,则您可以访问 USER_ID/Feed .这是因为 USER_ID/Feed 终结点仅在用户向您的应用授予 read_stream 权限时才可用.不允许使用应用程序访问令牌.
  2. 如果该用户不是具有 read_stream 的应用程序用户,则可以访问 USER_ID/链接.这是因为不需要 read_stream 权限即可访问此终结点.不允许使用应用程序访问令牌.
  3. 如果这是页面,则可以访问 PAGE_ID/Feed (更好)或 PAGE_ID/链接.允许使用应用程序访问令牌,但受限帖子除外.因此,最好使用用户访问令牌.
  1. If the user is your app user authorized with read_stream permission, then you access the USER_ID/feed. It's because USER_ID/feed endpoint only available if user give permission read_stream to your app. App Access Token is not allow.
  2. If the user is not your app user with read_stream, then you access the USER_ID/links instead. It's because no read_stream permission require to access this endpoint. App Access Token is not allow.
  3. If this is a page, then you access the PAGE_ID/feed(better) or PAGE_ID/links. App Access Token is allow except restricted posts. So it's better to use User Access Token.

如文件所述:

查看公共链接需要任何有效的访问令牌.

Any valid access token is required to view public links.

此陈述是错误的并且具有误导性,因为App Access令牌可能能够读取 PAGE_ID/链接(非限制性帖子),但无法读取 USER_ID/链接端点.

This statement is wrong and misleading because App Access Token may able to read PAGE_ID/links(non-restricted post) but it can't read the USER_ID/links endpoint.

还有其他一些变体端点,例如USER_ID/状态,其中:

Theres's some other variant endpoints, e.g. USER_ID/statuses, in which:

  1. 不允许使用应用访问令牌.

  1. App access token not allow.

如果用户A 未向应用X授予权限 user_status,则(App X)用户A 访问令牌访问user_A_ID/状态只会返回状态键入通过应用X发布的帖子.

If the user A did not give permission user_status to app X, then (App X)User A Access Token access user_A_ID/statuses will only return status type posts post via app X.

如果用户A 授予了对应用X的权限 user_status,则(应用X)用户A 的访问令牌访问user_A_ID/statuss将返回所有状态类型发布没有应用限制.

If the user A did give permission user_status to app X, then (App X)User A Access Token access user_A_ID/statuses will return all status type posts without app restriction.

如果用户A 未向应用X授予权限 user_status,则(应用X)用户B 访问令牌访问user_A_ID/状态将不返回任何数据.

If the user A did not give permission user_status to app X, then (App X)User B Access Token access user_A_ID/statuses will not return any data.

如果用户A 授予了对应用X的权限 user_status,则(应用X)用户B 访问令牌访问user_A_ID/statuss将返回所有状态类型发布了没有应用限制(属于公开).

If the user A did give permission user_status to app X, then (App X)User B Access Token access user_A_ID/statuses will return all status type posts without app restriction which was public.

更新: Facebook API再次更改,现在USER_ID/链接仅可用于同一应用程序用户ID.

Update: Facebook API changed again and now USER_ID/links only accessible for the same app user id.

这篇关于使用Facebook Graph API v2.0访问用户供稿的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆