Facebook open graph private group feed request

允我心安 提交于 2020-01-02 07:09:09

问题


I want to get data from graph api, in particular I try to get timeline from a group. For example lets take a look at request provided on fb developers overview...

https://graph.facebook.com/195466193802264 this returns a json with group info as expected

https://graph.facebook.com/195466193802264/feed this should return group's timeline, but I get the error below

{ "error": { "message": "An access token is required to request this resource.", "type": "OAuthException", "code": 104 } }

So I created a fb app (I suspected I will need to do this at the begining) and created an access token, but then I could not find any example how to send an access token together with get request, I only found an example how to send access token with a post request using curl. I even tried to fake a browser with python using mechanize and have logged in fb, and confirmed that I agree with apps permisions... again, where to put the token to get data??

I think this api is great, but documentation is just almost great, in the first video the guy tells you that using graph api is the same as making regular http requests, which it should be, but then please provide a working example how to do it...

So can someone please show me how to properly get access token with app key and secret and how to pass this token with the above request for a group's timeline? thank you very much


回答1:


For GET requests, you just use a query string parameter:

https://graph.facebook.com/195466193802264/feed?access_token={access token}

As far as the access token, according to the documentation you need:

To read a Group, you need:

  • any valid access_token if the group is public (i.e. the group's privacy setting is OPEN)
  • user_groups permission for a user's non-public groups
  • friends_groups permission for a user's friend's non-public groups
  • Groups for Apps and Games require the use of an App access_token.


来源:https://stackoverflow.com/questions/19232117/facebook-open-graph-private-group-feed-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!