Reputation: 3672
I have a button "share on Facebook" in my website. When the user clicks on it, it opens a popup to share a picture on his profile. This works but I have a problem with the callback (I want to know if the user has shared something or just closed the popup without sharing anything).
I am trying to get the callback response in jquery
. I have exactly the same problem as in this post:
FB.ui feed not giving a callback. Unfortunately, the accepted answer just says to empty the cache, which did not work for me.
My code :
FB.ui(
{
method: 'feed',
name: 'Share a photo',
link: url,
picture: path,
},
function(response)
{
if (response && response.post_id)
{
window.console&&console.log('Post was published.');
}
else
{
window.console&&console.log('Post was not published.');
}
});
Why is the response empty?
Upvotes: 0
Views: 663
Reputation: 73984
You only get a Post ID after sharing if you authorize the user with the publish_actions
permission. You will also have a hard time getting any callback without that permission, for a good reason: Usually people want to use it to do something that is not allowed anyway - rewarding users in some way for sharing or gating content:
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.
Source: https://developers.facebook.com/policy/
Upvotes: 2