Creating a First Facebook Application

  1. Before you start, you need
    • Facebook account (obviously) with added Developers app.
    • A web location to host the application. In that location, create a sub-folder for your application (can be empty for now). Later referred to as http://yourhosting.com/yourapp
  2. Go to Facebook Developers page and click Set Up New Application button.
  3. Enter the Application Name, agree to the Terms of Service, and click Create Application button.
  4. On Edit Application page, which will be opened after application is created (or can be opened by choosing Edit Settings on My Applications page, while application you want to edit is selected), go to Canvas tab.
  5. In Canvas Page URL, specify the URL, on which application will be available inside Facebook.
  6. In Canvas Callback URL, specify the http://yourhosting.com/yourapp URL.
  7. Go to your hosted space and create a “default” page (e.g. default.htm or index.html, depending on hosting service) with the authentication code described on Authentication Page, Single Sign-on with the JavaScript SDK section. The values for FACEBOOK_APP_ID and FACEBOOK_SECRET have to be replaced with values that can be found on Basic tab of Edit Application Page.
  8. Now try to access your application via Facebook Canvas Page URL. You should get the “Logged out” page at first, with option to login. Once you login, you should see a “User ID”. This application doesn’t do anything, but this is your first app! You can add a “Hello, world!” line to it too, if you wish.
Creating a First Facebook Application