Every repository with this icon (
Every repository with this icon (
| Description: | The facebooker Rails plugin edit |
-
My be we should combine these two methods?
Comments
-
IncorrectSignature when FB user is not logged in and app is not authorized
5 comments Created 5 months ago by ghazelhttp://groups.google.com/group/facebooker/browse_thread/thread/ac8df9ff7fd12edc#
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 or previously authorized works fine.
This is facebooker 1.0.29 as you can see in the stack trace, but I tried 1.0.31,
1.0.26 (because of http://github.com/mmangino/facebooker/issues#issue/3
) and 1.0.37 from github. All give the same error.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:26Here'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
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://mysite.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 endHere are the specifics of the request and the entries in my log:
1) clicked link to http://apps.facebook.com/mysite/
Processing FacebookController#show (for 69.63.180.250 at 2009-06-05 17:33:49) [GET] Parameters: {"fb_sig_time"=>"1244248429.6207", "fb_sig_in_new_facebook"=>"1", "fb_sig_app_id"=>"33333333333", "fb_sig"=>"44444444444444444444444444444444", "action"=>"show", "fb_sig_locale"=>"en_US", "_method"=>"GET", "fb_sig_in_canvas"=>"1", "fb_sig_position_fix"=>"1", "controller"=>"facebook", "fb_sig_request_method"=>"GET", "fb_sig_logged_out_facebook"=>"1", "fb_sig_added"=>"0", "fb_sig_api_key"=>"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"} Filter chain halted as [:ensure_application_is_installed_by_facebook_user] rendered_or_redirected. Completed in 4ms (View: 0, DB: 0) | 200 OK [http://mysite.com/facebook/]2) logged in to Facebook
3) authorized application on Facebook
Processing FacebookController#show (for 66.11.22.11 at 2009-06-05 17:34:25) [GET] Parameters: {"action"=>"show", "installed"=>"1", "controller"=>"facebook", "auth_token"=>"77777777777777777777777777777777"} Facebooker::Session::IncorrectSignature (Facebooker::Session::IncorrectSignature):Comments
This rather hilarious patch points out the problem. The request does not contain fb_sig parameters, so I simply avoid verifying any signature. (Obviously this is wrong, but it runs)
module Facebooker module Rails module Controller alias_method :old_verify_signature, :verify_signature def verify_signature(facebook_sig_params,expected_signature) if facebook_sig_params.include? 'api_key' old_verify_signature(facebook_sig_params,expected_signature) else true end end end end endThe request is then properly redirected, and my app works:
Processing FacebookController#show (for 66.11.22.11 at 2009-06-05 19:50:37) [GET] Parameters: {"action"=>"show", "installed"=>"1", "controller"=>"facebook", "auth_token"=>"3333333333333333333333333333333"} Redirected to http://www.facebook.com/install.php?api_key=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&v=1.0 Filter chain halted as [:ensure_application_is_installed_by_facebook_user] rendered_or_redirected. Completed in 12ms (DB: 0) | 302 Found [http://mysite.com/facebook/?auth_token=3333333333333333333333333333333&installed=1]Are you using any method that calls facebook_params? If so, that requires a valid signature.
It looks like application_is_installed? is causing the probelms. You might have better luck asking on the google group, as there are more eyes
I ran into the same problem with missing params, specially with iframe applications. Me and a friend hence created Facebooker Plus which does a number of things to make the params always available.
I must point out though, that it's completely untested for canvas applications.
-
For some reason this two gems does not work together.
Comments
tonytargonski
Wed Jul 29 08:49:15 -0700 2009
| link
Could you provide some more information? In which way does the problem manifest itself? Errors in the log, unexpected behaviour, etc...
-
I believe that the extended permissions url: Session#permission_url yields wrong URL according to:
http://wiki.developers.facebook.com/index.php/Authorization_and_Authentication_for_Desktop_Applications#Prompting_for_Permissions
http://wiki.developers.facebook.com/index.php/Authorization_and_Authentication_for_Facebook_for_Mobile_ApplicationsI've created a patch: http://github.com/pk/facebooker/commit/f2c295aba3b02641572c0db360178d017911cec8
Pull request sent.
Comments
tonytargonski
Tue Aug 18 07:34:27 -0700 2009
| link
wiki talks about getting permissions via Facebook Connect. Do you know if that's just the new preferred way, or has the old API also been deprecated?
Don't know. The wiki is sometimes a bit confused. Once they use authorize.php once they use prompt_permissions.php. By count it's in favor of prompt_permissions.php :-)
The only other mention of authorize.php is on: http://wiki.developers.facebook.com/index.php/Extended_permissions for mobile apps but on the mobile apps documentation it talks about prompt_permissions.
If someone is using the AJAX API this url won't be used because JS communicate with FB differently I believe.
But really I'm FB API newbie. The authorize.php didn't work for me.
The final solution needed a bit more: http://github.com/pk/facebooker/commit/34d1930158ab4a399bd510e0256f6fe03864a421
-
I've tried to get some photos from Facebook today. All my attempts failed with error that the signature is incorrect. I've fixed the issue by patching get_photos in a way how other *_url methods works.
Please checkout this commit: http://github.com/pk/facebooker/commit/4315b431f40a0b8343b3955538b527b46de93501
It doesn't do anything more than just create hash from params and filter that hash by values which are nil.
Now I'm able to get photos from FB using AID, PID or Subject_id.
Comments
Better way how to get rid of nils in Hash:
http://github.com/pk/facebooker/commit/211887809e8dec1970502bdb51e8d15bc005df15 -
PATCH: login_url parameters doesn't conform with the Wiki
0 comments Created 3 months ago by pkTo get the desired experience when using login and FB connect we must allow to pass fbconnect parameter in URL, see:
http://wiki.developers.facebook.com/index.php/Authorization_and_Authentication_for_Desktop_Applications
http://wiki.developers.facebook.com/index.php/Connect/Authorization_WebsitesThere is also ext_perm parameter which allows you to ask for Extended permissions in one go.
Please checkout the following patch: http://github.com/pk/facebooker/commit/0e5f411976d9822fa47f803847db7ec0709c2adb
I wonder how up to date is the Facebooker? There seems to be many inconsistencies in the code and the FB Wiki.
Comments
-
Can't convert nil to Integer in Session secure_with!
1 comment Created 3 months ago by natewareThis started happening - maybe FB changed the way it's passing expires? Or Ruby 1.9 is different?
Line 198 facebooker/lib/facebooker/session.rb tries to do Integer(expires) but if expires is nil this explodes on 1.9. The fix I added was just to check for expires being nil:
def secure_with!(session_key, uid = nil, expires = nil, secret_from_session = nil) @session_key = session_key @uid = uid ? Integer(uid) : post('facebook.users.getLoggedInUser', :session_key => session_key) @expires = expires ? Integer(expires) : nil @secret_from_session = secret_from_session endNot sure if this is the best fix, but seems to work
Comments
-
Under Ruby 1.9, "rake test" fails with UnableToLoadAdapter exception
4 comments Created 2 months ago by saadiqThe full stack trace can be found here: http://pastie.org/624106
Any attempt to run tests results in this error:
/Users/saadiq/dev/hotpotato-web-prototype/vendor/plugins/facebooker/lib/facebooker/adapters/adapter_base.rb:43:in `load_adapter': Facebooker::AdapterBase::UnableToLoadAdapter (Facebooker::AdapterBase::UnableToLoadAdapter)Comments
I'm getting the same thing with ruby 1.8.7 running rspec
Take a look at this solution here: http://bit.ly/XhK5k
-
Redirected to app server's address instead of facebook app's address after login
0 comments Created 2 months ago by linzhpSteps to reproduce:
1. logout facebook
2. visit http://apps.facebook.com/my_app_that_should_be_in_canvas, then you will be redirected to facebook's login page
3. Input you username/password
4. After successful login, you will find facebook redirect you to the app's server address instead of http://apps.facebook.com/my_app_that_should_be_in_canvasHere is the way I fix this issue: in lib/facebooker/rails/controller.rb
def create_new_facebook_session_and_redirect! session[:facebook_session] = new_facebook_session next_url = after_facebook_login_url || default_after_facebook_login_url in_canvas = facebook_params['in_canvas'] top_redirect_to session[:facebook_session].login_url({:next => next_url,:canvas=>in_canvas}) unless @installation_required false endComments
-
Undefined method text for Facebooker::Tag
0 comments Created 2 months ago by chrisbirkinshawIt seems both text and created are not allow to be used in the model. I altered the following file:
lib/facebooker/models/tag.rb
before:
attr_accessor :pid, :subject, :xcoord, :ycoordafter:
attr_accessor :pid, :subject, :xcoord, :ycoord, :text, :created
But I was wondering why this was omitted in the first place. Is there a reason?
Thanks,
Chris
Comments
-
Should give good warning when badly configured
0 comments Created about 1 month ago by marcandreIt's easy to make an error when configuring facebook. A typo in the facebooker.yml, in the name of the file, or by misplacing it. If you do, you might get very obscure errors
NoMethodError in User sessionsController#new
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+Turns out Facebooker.api_key might return nil.
lib/facebooker/rails/controller.rb:125 doesn't check that and add "_" to it.I suggest raising if there is no api_key, say like:
index 1bf2d14..032e781 100644 --- a/lib/facebooker/adapters/facebook_adapter.rb +++ b/lib/facebooker/adapters/facebook_adapter.rb @@ -24,7 +24,7 @@ module Facebooker end def api_key - ENV['FACEBOOK_API_KEY'] || super + ENV['FACEBOOK_API_KEY'] || super || raise("Can not find the api_key for facebooker. Please check the settings in config/facebooker.ym end def secret_keyComments
-
Fix for "Incorrect signature (Facebooker::Session::IncorrectSignature)" in Desktop session
0 comments Created about 1 month ago by zenchildHere is a patch for an issue that was documented by "TheFamilyGuy" at this link => http://tinyurl.com/yfql4yw
I am creating a Desktop app with Facebooker and the addition of hash[:session_key] = @session_key fixes the error mentioned in the previous link.
Link to patch => http://gist.github.com/218926
Comments
-
diff --git a/lib/facebooker/session.rb b/lib/facebooker/session.rb index df052a2..9c29a86 100644 --- a/lib/facebooker/session.rb +++ b/lib/facebooker/session.rb @@ -239,9 +239,12 @@ module Facebooker def fql_query(query, format = 'XML') post('facebook.fql.query', :query => query, :format => format) do |response| type = response.shift - return [] if type.nil? - response.shift.map do |hash| - fql_build_object(type, hash) + if type.nil? + [] + else + response.shift.map do |hash| + fql_build_object(type, hash) + end end end endComments
-
rake facebooker:tunnet:status does not work with non-standard ports
0 comments Created 20 days ago by trevmexThis fixes the issue (in lib/tasks/tunnel.rake line 22):
ifssh #{@public_host} -l #{@public_host_username} -p #{@ssh_port} netstat -an | egrep "tcp.*:#{@public_port}.*LISTEN" | wc.to_i > 0Comments
-
secure_with_cookies! calls verify_signature which skips the verification if Rails > 2.3 and Rack::Facebook is used as a middleware. The problem is that the Rack middleware only verifies params and not cookies. The verification for the cookie should also happen inside Rack::Facebook.
I think the best approach is for most of the code in lib/facebooker/rails/controller.rb to go into a module that is included by Rack::Facebook and Rail's Controllers. facebook_session should also be set inside Rack's env['facebook_session'] by Rack::Facebook so that the facebook session can be shared across all Rack applications (including middlewares and rails).
Comments
-
Is facebooker rails 3 compatible?
If not, how much effort will it take to make it compatible?
Thanks.
Comments











