Eukaliptus is a set of helpers to help you build Facebook applications, fan pages tabs or integrate Facebook in your web site.
It generates the necessary JS code to perform requests to Eukaliptus Rack middleware that fixes cookies security problems related with running iframe applications inside facebook. It is also useful for Facebook connect apps.
With Eukaliptus and Koala it’s very easy to build-up a rock solid Facebook connect application with JS authentication that works in all browsers in less that 5 minutes.
It will be a key component of our next product Eukaliptus Core.
We provide integration with two authentication methods out of the box, Koala Facebook library, see github.com/arsduo/koala and the combination of Omniauth + Devise.
Require it in your Gemfile
gem 'eukaliptus'
Update your bundle
$ bundle install
Run the generator
$ rails generate eukaliptus:config
Go to www.facebook.com/developers/createapp.php and create a new Facebook app, configure it and then fill up the file config/facebook.yml with the details of you newly created app.
You are now ready to begin using Eukaliptus.
jQuery library for the front-end. Your rails application must be using jQuery as it will be the default JS library for Rails from 3.1+.
Just behind the <body> tag in your application.html.erb write:
<%= fb_init %>
This generates the necessary JS code to perform request to Eukaliptus that fixes cookies security problems involved in running iframe applications in Safari and IE6+
Then you can place a link anywhere in your code that gives the user the chance to login with Facebook:
<%= link_to "Log in with Facebook", "#", :onclick => "login('/redirect/path');" %>
All helpers are namespaced with fb_ prefix you can find the documentation in this file lib/eukaliptus/view_helpers/facebook_helpers.rb
We recomend using JavaScript authentication with Koala and it’s very easy to implement.
See the Authentication section in Koala Wiki github.com/arsduo/koala/wiki/Koala-on-Rails
Eukaliptus will be aware that you are using Omniauth and changes the redirection workflow.
Implement the authentication as explained in Devise Wiki github.com/plataformatec/devise/wiki/OmniAuth:-Overview
Then in your OmniauthCallbacksController you will be getting a new get param :redirect_to you can add this at the end of your provider action:
... redirect_to params[:redirect_to] and return
You can use Koala in the mix too and instantiate a new Koala GraphAPI object as follows:
Koala::Facebook::GraphAPI.new(env["omniauth.auth"]['credentials']['token'])
Copyright © 2011 Season Advertising S.L. www.season.es See LICENSE.txt for further details.