Integrating with Facebook

To create a game that uses Facebook for authentication, you need to create a Facebook application to generate an Application ID and App secret.

Generating the Facebook Application

To create the application, make sure you are logged in to Facebook, and then go to https://developers.facebook.com. Click the Apps button on the top of the page, and then the + Create New App button. Enter the name Blob Clicker as the name of the Application, as shown in Figure 20-1, leaving the app namespace blank.

Figure 20-1: Creating a new app.

c20f001.tif

If you haven’t yet verified your account, you’ll need to go through a security check as well.

Next, you are presented with your App ID, App Secret, and a screen of options to configure the Application. To start, the Application runs off of localhost for testing purposes. To set this up, fill in the domain name localhost in the App Domains field. Next, further down the page, click the section Website with Facebook Login, and type the URL http://localhost:3000/ (don’t forget the final forward slash “/”) into the Site URL field. Figure 20-2 shows how this screen should look.

Figure 20-2: Basic app information.

c20f002.tif

At the bottom of the page, click the Save Changes button. Don’t share your App Secret with anyone else. (The secret in Figure ...

Get Professional HTML5 Mobile Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.