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?


3 Answers 3


You can use the Facebook Graph API for that purpose (there are several SDKs available).

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 (publish_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 :)

You don't kneed to place a log-in button, and you don't need to set permissions. I found this Stack Overflow question that explains a quick way to do it just in javascript. The user is asked post the item to their wall, and they can either add a message and post or just skip it.

  • \$\begingroup\$ +1. That's actually a good way to achieve what you want. FYI: You don't need special permissions for this, as the message will be displayed to the user beforehand, so he can review/modify it before posting. This also means that he can modify the score that will be posted to his FB-wall though :) \$\endgroup\$
    – bummzack
    Commented Jul 19, 2011 at 6:40
  • \$\begingroup\$ @bummzack It actually won't let them modify the score if you put it in the title or the description. They only get to modify the message \$\endgroup\$
    – cstack
    Commented Jul 19, 2011 at 13:52
  • \$\begingroup\$ Is it also applicable for Eclipse IDE for Java developers associated with LibGDX? I'm making an Android game app that lets you post it onto the wall via Facebook as long if the player got the new high score or achievements? \$\endgroup\$ Commented Jan 10, 2013 at 5:31

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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .