Search code examples
facebookfacebook-javascript-sdkfacebook-sharer

Grant publish_actions


I want to share some url to facebook, here is the code

  FB.ui(
  {
     method: 'share',
     href: "http://SomeWebPage"
  }, 
  function (response) {
  });

On documentation of the Share Dialog written that response data

Only available if the user is logged into your app using Facebook and has granted publish_actions. If present, this is the ID of the published Open Graph story.

Lets say that user not logged in to Facebook and click on my share button what i am see is that

The user about to login my app "Pay oneerDev"

Login page

But were exactly publish_actions mentioned above are defined?
How user agrees this action?

Then when user shares i get "[]" as a response data all the time instead of some id, there is no way to know if user actually shared or cancelled or some error occurred.


Solution

  • For publish_actions, you would need to implement Login, and you would need to go through Login Review with that permission before it´s available for everyone. Just to know if something was shared or not will definitely not get that permission approved, because Share Gating is not allowed according to the platform policy:

    4.5: Only incentivize a person to log into your app, enter a promotion on your app’s Page, or check-in at a place. Don’t incentivize other actions.

    Btw, in order to make the Share Dialog work, the user just needs to login to Facebook - NOT your App. Make sure you understand the difference.