问题
I know it's possible to get an rss feed or whatever for wall posts of groups. However, every time I try it with a closed group that I belong to, it doesn't work. Is this possible if you aren't the admin or owner of a group but just a member? Here are the steps that I've taken so far.
- Create an application on http://developers.facebook.com/setup/
- When you are done, you will see App Name, App URL, App ID, and App Secret. Copy down these data.
- access https://graph.facebook.com/oauth/authorize?client_id={CLIENT_ID}&scope=offline_access&redirect_url={URL}.
Replace {CLIENT_ID} with your App ID. Replace {URL} with your App URL.
- When you prompt “Request for Permission” page, click [ ALLOW ] button.
- You will be redirect to {URL}/?code={YOUR CODE}
- Copy down {YOUR CODE}
- Access https://graph.facebook.com/oauth/access_token?client_id={CLIENT_ID}&redirect_uri={URL}&client_secret={APPLICATION_SECRET}&code={YOUR_CODE}
Replace {CLIENT_ID} with your App ID Replace {URL} with your App URL Replace {APPLICATION_SECRET} with your App Secret Replace {YOUR_CODE} with your {YOUR CODE}
When you hit the url, you will get access token.
At this point I don't get an access token I get this.
{
"error": {
"message": "This authorization code has expired.",
"type": "OAuthException",
"code": 100
}}
The problem is, I just created the auth code like 2 seconds prior. No way could it have expired. So I can't follow the rest of the steps below until I have that access token.
Copy your access token.
Now, access the following url with your access token.
http://graph.facebook.com/{YOUR GROUP ID}/feed?access_token={ACCESS TOKEN}
When you go to your group page, you url is something like /group.php?gid=xxxxxxxxx. In this case, gid is your group id.
回答1:
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.
回答2:
You should switch to v2.3 because from version 2.4 facebook restrict with closed group and also user new feed.
Try with v2.3 and check on read_stream on get token access. Note that only when we switch to v2.3, we see the read-stream option
https://tngotran.wordpress.com/2017/02/01/facebook-api-explain-example-and-real-project-tutorial/
来源:https://stackoverflow.com/questions/16816436/is-it-possible-to-get-a-facebook-feed-to-a-closed-group-that-i-belong-to-but-do