PlayerIO

The fastest way to build online games without breaking a sweat.

QuickConnect for Facebook

Facebook Logo

This service can be used for any type of Facebook application, whether it's a completely integrated Facebook App, a game using Facebook Connect, or a desktop Facebook application. The purpose of this service is to securely connect Facebook users to the Yahoo Games Backend Service.

You can also list all the users and export them in your QuickConnect Control Panel, just like you can list and export the users of all other QuickConnect services.

Setup on Yahoo Games Network

Creating a Facebook Application

If you don't have a Facebook Application, you will need to make one. Here are some external resources that can help you:

To use QuickConnect for Facebook, you will have to copy your Facebook App ID and App Secret (found under Basic Settings for your app on Facebook) into the QuickConnect settings page in the Games Control Panel.

Facebook Connect

The different types of Facebook applications work differently with regards to how you authenticate a user: if it's on a stand-alone webpage you need to popup a dialog asking the user to sign in, if it's a Facebook Canvas application, the user will automatically be authenticated.

Regardless of which type of application you have, you will be able to get user credentials in the form of a Facebook access_token, which you'll need to pass to the system.

If you are making a canvas application, the code for it will look something like this:


Facebook Connect Popup

Yahoo Games Network also provides the facebookOAuthConnectPopup() method, for the times when you just want to login a user via Facebook as quickly, and with as little hassle, as possible.

Setup on Facebook

If you want to use the facebookOAuthConnectPopup() method, you'll have to specify that Yahoo Games Network is the site url for your Facebook app:

Set the Site URL of your Facebook Application to:
http://<game id>.fb.playerio.com/fb/

You have to insert the game id of your game in the url, or you can just copy-paste it from the Facebook QuickConnect setup page in the Control Panel.

If you don't already have a Facebook application you can go to https://developers.facebook.com/apps, choose Create New App and pick a name for it, and when you get to the Basic Settings page for your app, select "Website" as an integration and enter the Site URL in the field that appears.

If you already have a Facebook application, go to the above page, choose Edit App instead, then follow the rest of the instructions above.

Calling the method

Once you've setup the Site URL in Facebook as described in the previous section, you can call the method, which will open a Facebook login dialog in a browser window:

errorlog overview

When the user has fully logged into Facebook, the method call will return a connected Client. You'll also get the Facebook access_token so you can call Facebook API methods with the Facebook Graph API.

One of the arguments to the methods is a list of permissions you wish to request from Facebook, like "post to stream" or "offline access". You can read a full list of the permissions you can request on the Facebook page for extended permissions.

If you request the "offline_access" permission, you can save the returned Facebook session (for instance using LocalStorage), and later use it to auto-login returning users into your game and Facebook.

You can also specify the window name where the Facebook login dialog will be opened. This is usefull if you don't want to open a brand new browser window, but would rather show an iframe or reuse an existing window.

Here is an example of using the Facebook Connect OAuth Popup as login provider in a game:


For more information, just check out our AS3 client reference documentation.