Friday, June 1, 2007

Facebook Platform API for AS3, and group.

I mentioned briefly that we're building an api for working with Facebook's new Platform. As part of the 'release early, release often' open source mantra, we're releasing what we have right now. Its not fleshed out, but I think that the model that we've built is extensible and easy to use.

Download the API here

Our Facebook Group with more information, documentation, etc.


Here's some of our current features -

Authentication- The Facebook object handles authentication and security automatically. Its transparent, you just don't have to think about it.

Ease of use- Authentication can either be 'desktop' or 'web' style. This essentially means that you can test your app locally in desktop mode, and then deploy it web style. Our current testing model is to check a configuration xml to see what our authentication style should be:


if(configXML..mode == "desktop")
{
//start us up in desktop mode
var config_api_key:String = configXML..api_key;
var config_secret:String = configXML..secret;
fBook.startDesktopSession(config_api_key, config_secret);
}
else
{
//start us up in widget mode
fBook.startWidgetSession();
}

And so we deploy a different configXML file on our server which doesn't contain our secret for use in 'widget' mode, but we can test the flash locally, dramatically speeding development time!

Proxy support - When developing a Facebook application, you'll want to pass all requests to the Facebook API through your server for security reasons. This server should just mimic the Facebook api, and work in the same way:

fBook.useRedirectServer = true;
fBook.rest_url = configXML..redirect_server_url;

Extensibility - The Facebook AS3 object is extensible. This means that you can extend your proxy on the server with new methods, and extend the Facebook object with new FacebookDelegates to handle your application-specific service calls.


What we're currently looking at improving is fully implementing the Facebook API. After that we'll be adding more helper functions to improve the usability of the api. Things such as automatically grabbing all images in an album, etc.

Enjoy!!

1 comment:

Chelsea said...

Well written article.