First you'll need to setup Facebook JavaScript SDK: https://developers.facebook.com/docs/javascript/quickstart/v2.5
I have tried with open graph.
FB.ui({
method: 'share_open_graph',
action_type: 'namespace:action_type',
action_properties: JSON.stringify({
object_type:
{
'og:type': 'namespace:object_type',
'og:title': 'I scored 10 points on this ridiculous game...',
'og:image': 'http://www.bizreport.com/2011/02/03/android-logo-200x200.jpg',
'og:description': 'Description'
}
})
}, function(response)
{
if (response.post_id != null)
{
// handle response
}
});
action_type and object_type are from Facebook application which I am sure you're familiar with.
And you'll need to submit the application for review if you're using custom stories.
Since I plan on using standard share dialog with custom image, text and link, I didn't spend much time figuring out open graph and how to set it up.
FB.ui({ method: 'feed',
link: 'http://mysite.com/link-to-my-game',
picture: 'http://www.bizreport.com/2011/02/03/android-logo-200x200.jpg',
name: 'I scored 10 points on this ridiculous game...',
description: 'Description',
actions: [
{ name: 'Name of my site', link: 'http://mysite.com/' }
],
display: 'popup'
}, function (response)
{
if (response && response.post_id)
{
// handle response
}
});
Here you can see other parameters you may need: https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.5
With this approach, sharing works as soon as you make your application public.
I need something simpler and I didn't want to submit the application for review, so I went with second option, but the first option is more powerful in terms of customizing.
About that redirect_uri error, I think it is because that redirect_uri domain is not listed in App Domains on your Facebook application Settings page. (correct me if I am wrong)
I am no expert at this, I just spent some time searching what I need, collected the code and played with it.