Getting started guide

From Facebook Developers Wiki

Jump to: navigation, search

Contents

[edit] Quick Links to Main Documentation

[edit] Setting up an Application

Application management is done through the Facebook Developer Application. To create a new application, click the Set Up New Application link in the upper right. You'll be assigned an API key which identifies your application, and a "secret," which is used to authenticate requests (and as the name implies, should not be shared).

Once you've created your app, it will show up in your applications list. You can configure it via the "Edit Settings" link. There are several configuration options, some of which you'll need to change, depending on the intended functionality of your app. Here's an overview of some of them.

[edit] Can your application be added on Facebook?

This option specifies whether your application can be integrated into a Facebook profile. In order for your application to be integrated within Facebook (e.g. via a box on the profile or a link in the Applications menu), this option must be set to Yes. All of the integration points are described in detail in the Anatomy of a Facebook App guide. To add your application, you can either go to your application About page, or to www.facebook.com/add.php?api_key=YOUR_API_KEY.

On the other hand, if your application will exist exclusively outside of Facebook (either on a separate website or as a desktop app), leave this option set to "no."

[edit] Application Type

Select Web if your application is a Web application, and Desktop if it's intended to be run directly from the client. The technical difference between the two (with respect to the Facebook Platform) is significant during the API authentication procedure, and is described in detail in How Facebook Authenticates Your Application.

[edit] Callback URL

The Callback URL serves two functions:

  1. After users successfully log in to your app (see Authorizing Applications), they will be redirected to this page. Logging in serves to authenticate a user so that your app can take actions based on who they are. Once a user has logged in and authorized your app, you can prompt the user to integrate it into their Facebook experience.
  2. This URL also serves as the "canvas page" - see the next item.

More detail about the Callback URL can be found at Your Callback Page And You.

[edit] Canvas Pages

Canvas pages provides a way for your app to "live inside" Facebook, although Facebook doesn't actually host the 3rd-party content. Canvas pages get surrounded by the normal Facebook frame. Facebook will fetch the page content (i.e., what will be rendered inside the Facebook frame) from your callback URL.

For example, if your callback URL is example.com/ and your canvas page URL (see below) is apps.facebook.com/pokewall/, then apps.facebook.com/pokewall/poke.php will request example.com/poke.php.

Note that the canvas page URL is written in lowercase, and will be changed to lowercase even if you wrote it in uppercase.

[edit] Canvas Page URL

This is the URL at which your app's canvas pages exist. The URL is of the form apps.facebook.com/appname, where appname must be between 7 and 20 characters (inclusive), and can only contain letters, dashes, and underscores.

[edit] Side Nav URL

If specified, your application will appear as a link in the Applications menu (for users who have interacted with your application).

[edit] Icon

This is a 16 x 16 icon, which is displayed next to your app's name on the left nav (in addition to a few other places), if you specify a Side Nav URL.

[edit] Post-Add URL

This is the page to redirect the user after the application is added to a Facebook Page.

[edit] Post-Authorize Redirect URL

When a user authorizes your application, that user is redirected to this URL. Typically, you want to make this URL your canvas page URL, so that the user sees your application right after he or she adds it.

[edit] Post-Remove URL

After a user removes your application, this page will receive an automated POST call from Facebook containing the variable fb_sig_user (user ID). This page cannot be a Facebook-framed page, since they are removing the app means they are no longer using the app within Facebook.

The user will not see any content you display in this page. Its purpose is to let you write server-side code to log or handle the removal of that user.

[edit] Developer Mode

While you are developing your application, you may want to restrict its visibility. You can (and probably should) check this box to only allow developers of the application to add it. Note that developer mode only applies to applications which can be added on Facebook (see above). If your application is not set up such that it can be added on Facebook, this checkbox will not appear.

[edit] Logo

This is a 75 x 75 logo, used in headers or directory listings where a larger graphic can be displayed. To change this logo, in the developer application, click 'edit' next to Application Approved. The logo will be at the bottom.