7

I want to check whether the user has give publish_stream permission to my application or not. If not want to get publish_stream permission.

AliZubi
  • 91
  • 1
  • 5

3 Answers3

22

if you are using the Koala Gem just use:

#check wether wallpost is allowed
permissions = graph.get_connections('me','permissions')
@has_wallpost_permission = permissions.select{|o| o['permission'] == 'manage_pages'}.length == 1 
mb21
  • 34,845
  • 8
  • 116
  • 142
Karl Adler
  • 15,780
  • 10
  • 70
  • 88
  • That's half of it but how do you tell Koala to request certain permissions from the user when they authorise the app? – Dave Sag Aug 27 '12 at 02:25
0

If you don't use Koala you can send request 'GET /{user-id}/permissions' This is described in 'Checking Current Permissions' section here https://developers.facebook.com/docs/facebook-login/permissions/v2.1

kaleb4eg
  • 2,255
  • 1
  • 18
  • 13
0

You must autorize user with publish_stream permission. In rails I do it with OmniAuth gem.

My post can help you - Publish stream in Facebook & Twitter with OmniAuth

super_p
  • 720
  • 9
  • 11
  • The scenario is the user has authorize the app. I want to check if the user given certain permission to my app. if not I want to take that permission. Is this possible in facebook graph API or in rails 3. My app is running in facebook canvas. – AliZubi Nov 18 '11 at 08:14
  • You can use FQL query to [check permission](http://developers.facebook.com/docs/reference/fql/permissions/) – super_p Nov 18 '11 at 12:33