Revision of Audi A3 Facebook app from Tue, 2013-10-08 17:55

We have just launched https://www.facebook.com/AudiHK/app_137123389829201
A facebook iframe app, which is not exactly a site building project my company Document On Ready usually do

Anyway, want to highlight there is a few main points:
Facebook app
like gate
IE9 + Facebook app
codeigniter
dbvars

Facebook app
The concept of “facebook app” is so confused even within facebook’s help page
The “facebook app” that can be installed to fans page is actually an iframe
I recommand reading https://developers.facebook.com/docs/games/canvas-games/ (2013-08) inside out. The meta web have so many other “tutorials” that is outdated, even within facebook’s docs.

The authentication is complicated.
1. User grant your app some permissions,
2. you get some signed request, information about the user etc.
But inside an iframe is not the same as a standalone. You get different information.
This makes development sucks.
1. You need to create a dummy page to embed
2. cannot test all functionalities on localhost

Facebook app development itself is a mess. But deployment is yet another huge pain because some configurations is sitting inside facebook’s developer page (https://developers.facebook.com/apps). You want to have staging? create another facebook app and good luck.

Like gate
Like gate is the concept which you need to like the page that installed the app to continue.
Facebook do provide a like button on top right corner to your app
Within an embedded iframe app, you can get the like_status flag inside signed_request
But in a separate standalone access, you do not have that.

We configured the landing page as /like_gate and redirect to /en if we found the user had “liked”
That way /like_gate have very simple logic and save us time on debugging
But that leads to the next bomb

IE9
IE9 have a very strange iframe access-origin problem.
IE9 displays an error message about cross domain upon redirection inside facebook iframe.
Stackoverflow:
http://stackoverflow.com/questions/10919056/facebook-app-cannot-be-displ...
You can find much more header secret code
We finally solve it using
P3P: CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
with

There are simple database requirement from this app
We picked codeigniter as the backend for its simple MVC structure, well documented, reasonable object oriented

You can integration facebook’s class by:
1. putting the facebook.php and base_facebook.php application/libraries/
2. load it in controller: $this->load->library('facebook', $fb_config);
3. use it by: $user = $this->facebook->getUser();

dbvars
https://github.com/EllisLab/CodeIgniter/wiki/Storing-variables-config-in...
is a simple variable storing library that we use to store flags, a bit like NoSQL

Snapshot: 
Google