12

我知道有可能获得 RSS 提要或任何用于群组墙贴的内容。但是,每次我与我所属的封闭组一起尝试时,它都不起作用。如果您不是组的管理员或所有者而只是成员,这可能吗?这是我到目前为止所采取的步骤。

  1. 在http://developers.facebook.com/setup/上创建一个应用程序
  2. 完成后,您将看到 App Name、App URL、App ID 和 App Secret。把这些数据抄下来。
  3. 访问https://graph.facebook.com/oauth/authorize?client_id= {CLIENT_ID}&scope=offline_access&redirect_url={URL}。

将 {CLIENT_ID} 替换为您的应用 ID。将 {URL} 替换为您的应用 URL。

  1. 当您提示“Request for Permission”页面时,单击 [ ALLOW ] 按钮。
  2. 您将被重定向到 {URL}/?code={YOUR CODE}
  3. 抄下{您的代码}
  4. 访问https://graph.facebook.com/oauth/access_token?client_id= {CLIENT_ID}&redirect_uri={URL}&client_secret={APPLICATION_SECRET}&code={YOUR_CODE}

将 {CLIENT_ID} 替换为您的应用 ID 将 {URL} 替换为您的应用 URL 将 {APPLICATION_SECRET} 替换为您的应用秘密 将 {YOUR_CODE} 替换为您的 {YOUR CODE}

当您点击 url 时,您将获得访问令牌。

在这一点上,我没有得到访问令牌。

{
"error": {
  "message": "This authorization code has expired.",
  "type": "OAuthException",
  "code": 100
}}

问题是,我刚刚创建了 2 秒前的身份验证代码。怎么可能已经过期了。因此,在获得该访问令牌之前,我无法执行以下其余步骤。

复制您的访问令牌。

现在,使用您的访问令牌访问以下 url。

http://graph.facebook.com/ {YOUR GROUP ID}/feed?access_token={ACCESS TOKEN}

当您进入您的群组页面时,您的网址类似于 /group.php?gid=xxxxxxxxx。在这种情况下, gid 是您的组 ID。

4

2 回答 2

5

To answer your question, yes you can access the posts even if you are not admin/owner. If you can see all posts of a group, there should be no reason not to be able to access them with the api.

First, check if the access token is having 'user_groups' checked, otherwise you will not be able to access a closed groups. You can play with Graph Explorer yourself, till you get the needed results.

If you experience problems after you get the right access token, then check if the token is not expired.

于 2014-04-25T15:43:58.950 回答
1

您应该切换到 v2.3,因为从 2.4 版开始,facebook 受限于封闭组以及用户的新提要。

尝试使用 v2.3 并在获取令牌访问权限时检查 read_stream。注意,只有切换到 v2.3,我们才能看到 read-stream 选项

https://tngotran.wordpress.com/2017/02/01/facebook-api-explain-example-and-real-project-tutorial/

于 2017-02-01T04:30:18.583 回答