I started developing a Facebook app for one of my existing websites. Since, I already had a working website and I prefer normal html and js over fbml and JS over FBML and FBJS, I decided to take the IFrame route. While working with my app, I ran into this bizarre problem where clicking on any link after loading the facebook app, gave me an invalid Signature exception. After digging my way through the Facebooker (Rails plugin for Facebook app dev) code, I find that the expected signature is nil inside the "verify_signature function". Turns out you need to append all your links in a Facebook iframe app with the fb_sig params. So, I created a function in Application.rb and set it as a before_filter
before_filter :set_facebook_params
ensure_application_is_installed_by_facebook_user
protected
def set_facebook_params
@fb_params = params.inject({}) do |collection, pair|
collection[pair.first] = pair.second if pair.first =~ /^fb_sig/
collection
end
end
The above code will extract out all the fb_sig params from the url and store it in @fb_params. Now add this hash to every url that you create inside you Iframe. This was the fix that I came in the middle of the might, and I am sure this may not be the best fix. But this works. Let me know if there is another workaround.