1

I've read a lot of documentation about FQL (awesome!) and finally I've found two great references which are suitable to retrieve all the posts from a Facebook group:

http://developers.facebook.com/docs/reference/fql/stream/

Retrieving posts and comments from a Facebook page

Well, now I have another problem: I need to give to my application the permission for retrieving the posts of a secret group (I am the owner of this group).

How can I give this permission to my application? Has the group owner (that is me in this case) to do something?

Thanks

Community
  • 1
  • 1
pAkY88
  • 6,262
  • 11
  • 46
  • 58

1 Answers1

2

The thing is you can't give your application direct access to the group. You, the group-owner, must act as the middle man for the permissions. You must ask for user_groups permission in your app, add your app to your profile and allow the user_groups permission. Then you must get a token from your user and tah-dah, everything is gonna work.

Long story short: Your app can have access to your groups, and you are the owner of the group, therefore your app has access to your group. But pay attention that you must use a user-token instead of app-token. Makes sense?

AndreM
  • 66
  • 1
  • 4
  • Yes, it makes sense. Let's see if I got it or not: - I create my application - I give to my application the permission for accessing data about my groups (the user_groups permission) - I get an user-token (the mine) and I use it in order to access posts and comments of my group Right? So, now there is another question: how can my application get an user-token? – pAkY88 Feb 12 '12 at 00:24
  • You can run some tests at the [graph api explorer](https://developers.facebook.com/tools/explorer), all the group options you can retrieve can be found [here](https://developers.facebook.com/docs/reference/api/group/), information about authentication and tokens [here](https://developers.facebook.com/docs/authentication/) including some php sample code, and if you're using php there is a nice [php sdk](https://developers.facebook.com/docs/reference/php/) to make things even easier. – AndreM Feb 12 '12 at 02:21
  • Thank you for the references. @AndreM told me that I should use an user-token instead of an app-token. So my question is the following: "How can I get an user-token after obtaining the user_groups permission?" This should work completely in background, so it has to be totally server-side. The user interaction is required only the first time, when the app needs the authorization. According to the official documentation I could send a request to this URL graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials Is that right? – pAkY88 Feb 12 '12 at 11:34
  • Yes, you can follow the sample php script [here](https://developers.facebook.com/docs/authentication/) – AndreM Feb 12 '12 at 12:14
  • Thank you very much. There is just one thing that I still don't understand: what means $my_url = "YOUR_URL"; ? What should I put as URL? The URL of my website, or something else? – pAkY88 Feb 12 '12 at 14:49
  • Its the return url, after facebook authenticates the user, it'll redirect to that URL with the token in the querystring – AndreM Feb 12 '12 at 18:52
  • Could the return URL be the same URL from which I'm performing the authentication request? – pAkY88 Feb 12 '12 at 19:04
  • Yes, as long as you handle the callback with the token, and the url is accessible through the internet, i dont see any problem. – AndreM Feb 12 '12 at 19:13