I have an HTML5 game on my site, and at the end, I want the user to have the option of posting their score to their Facebook wall. Is there an easy way to ask to post something to Facebook?
These are roughly the things you need to do:
- Create an app on Facebook. You can do this here. There you'll get your APP and API Keys that are needed for you to communicate with the Graph API.
- If your app wants to post to somebodies wall, he/she needs to grant your app that permission. For that you'll need authentication, specifically your app needs to ask for permission to write the users stream (
- If the user granted you permission, your app can then publish to his wall using the Graph API (read the section titled Publishing). If the user doesn't grant you permission, don't nag any further :)
To post on the user's wall, first register the app with Facebook. Set it up as a webpage app, even though it will be on your website and not theirs.
Now you can put a button on your site that will log the player into Facebook and then the game can post messages on their wall.