I'm getting an IncorrectSignature error when a user is both not logged
in to Facebook and has not authorized my application before. Any other
combination of logged in to FB or previously authorized works fine.
Details below (names and keys changed).
A brief summary of my app:
A user on my site clicks a link to
http://apps.facebook.com/mysite/.
This should prompt the user to login, authorize my app, and end up
back on my site at
http://mysite.com/profiles/pic?fb_photo=#{picurl}&fb_uid=#{facebook_session.user.id}
Here's the stack trace:
Facebooker::Session::IncorrectSignature
(Facebooker::Session::IncorrectSignature):
/usr/lib64/ruby/gems/1.8/gems/facebooker-1.0.29/lib/facebooker/
rails/controller.rb:205:in `verify_signature'
/usr/lib64/ruby/gems/1.8/gems/facebooker-1.0.29/lib/facebooker/
rails/controller.rb:190:in `verified_facebook_params'
/usr/lib64/ruby/gems/1.8/gems/facebooker-1.0.29/lib/facebooker/
rails/controller.rb:45:in `facebook_params'
/usr/lib64/ruby/gems/1.8/gems/facebooker-1.0.29/lib/facebooker/
rails/controller.rb:256:in `application_is_installed?'
/usr/lib64/ruby/gems/1.8/gems/facebooker-1.0.29/lib/facebooker/
rails/controller.rb:286:in
`ensure_application_is_installed_by_facebook_user'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:178:in `send'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:178:in `evaluate_method'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:166:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
action_controller/filters.rb:225:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
action_controller/filters.rb:629:in `run_before_filters'
/usr/lib64/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
action_controller/filters.rb:615:in `call_filters'
/usr/lib64/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
action_controller/filters.rb:638:in `run_before_filters'
/app/controllers/application.rb:26:in `call'
/app/controllers/application.rb:26
Here's my config/facebooker.yml
production:
api_key: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
secret_key: 88888888888888888888888888888888
canvas_page_name: mysite
callback_url:
http://mysite.com/
set_asset_host_to_callback_url: false
Here's the Facebook configuration:
Canvas Page URL:
http://apps.facebook.com/mysite/
Canvas Callback URL:
http://mysite.com/facebook/
Render method: FBML
(other optional URLs are blank)
Here is the route:
map.facebook '/facebook', :controller => 'facebook', :action => 'show'
Here is the controller:
require 'uri'
class FacebookController < ApplicationController
helper_method :facebook_session
ensure_application_is_installed_by_facebook_user
def show
rails_root = '
http://myhost.com/'
rails_path = "#{rails_root}profiles/pic?"
picurl = URI.escape(facebook_session.user.pic_big,
Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
url = "#{rails_path}fb_photo=#{picurl}&fb_uid=#
{
facebook_session.user.id}"
render :text => "<fb:redirect url=\"#{url}\" />"
end
end