Sunday, July 10, 2011

JQueryMobile app with Facebook integration and a Ruby on Rails backend

I am currently playing around with mobile app development.  I want to develop a mobile app that:

  1. Works across multiple devices (iPhone, Android, etc)
  2. Integrates with Facebook
  3. Has a Ruby on Rails backend to store app-specific data
I have implemented a toy jQueryMobile app to demonstrate the implementation of the above requirements. The toy app simply asks you to login with your Facebook credentials and lists your friends.  You can try it out by visiting using your mobile or desktop web browser.  The full source code for app is available at

Facebook authentication happens at the Ruby on Rails backend using the Omniauth gem.  This means that the backend can uniquely identify repeat visitors and associate app-specific data with them.  The backend can use the Facebook access token generated on login to retrieve the user's Facebook data, and pass it on for display on the frontend.  Alternatively, the backend can simply pass the Facebook access token to the frontend, which then uses JSONP to retrieve the user's Facebook data.  The latter approach is more efficient as it decreases the load on the backend.  The toy app uses this approach.  

The app also uses MongoDb (instead of mysql) and Heroku (for super-easy hosting of Ruby on Rails applications).

No comments: