public
Fork of carlosparamio/rack-facebook
Description: Rack middleware that parses and validates Facebook parameters
Homepage: http://evolve.st/articles/13-rack-facebook-a-new-rack-middleware-to-parse-facebook-parameters
Clone URL: git://github.com/mislav/rack-facebook.git
name age message
file README.markdown Fri Jan 09 05:00:41 -0800 2009 change http status code for bad requests to 400 [Carlos Paramio]
file Rakefile Fri Jan 09 01:07:55 -0800 2009 initial import [Carlos Paramio]
directory lib/ Tue Mar 31 18:48:17 -0700 2009 receive app name on init and pass it up the stack [davidhq]
file rack-facebook.gemspec Fri Jan 09 02:36:08 -0800 2009 point homepage to related Evolve Studio's blog ... [Carlos Paramio]
directory spec/ Tue Mar 31 18:48:17 -0700 2009 receive app name on init and pass it up the stack [davidhq]
README.markdown

This Rack middleware checks the signature of Facebook params, and converts them to Ruby objects when appropiate. Also, it converts the request method from the Facebook POST to the original HTTP method used by the client.

If the signature is wrong, it returns a "400 Invalid Facebook Signature".

Optionally, it can take a block that receives the Rack environment and returns a value that evaluates to true when we want the middleware to be executed for the specific request.

Usage

In your config.ru:

require 'rack/facebook'
use Rack::Facebook, "my_facebook_secret_key"

Using a block condition:

use Rack::Facebook, "my_facebook_secret_key" do |env|
  env['REQUEST_URI'] =~ /^\/facebook_only/
end

Credits

Carlos Paramio

http://evolve.st/