views:

323

answers:

1

Hello guys, I'm using sinatra/frankie/facebooker to prototype something simple to test the facebook api, i'm using mmangino-facebooker the more recent version from github and I cloned the most recent version of frankie. I'm using sinatra 0.9.6.

My main code is as simple as possible:

before do

  ensure_application_is_installed_by_facebook_user
  @user = session[:facebook_session].user
  @photos = session[:facebook_session].get_photos(nil,@user.uid,nil)
end

get "/" do
erb :index
end

get "/:uid/:image" do |uid,image|


  @photo_selected = session[:facebook_session].get_photos([image.to_i],nil,nil)


  erb :selected


end

The index page just renders a link to the other one (identified by regex "/:uid/:image") however I always get an error when it's trying to render the one identified by regex "/:uid/:image"

Facebooker::Session::MissingOrInvalidParameter: Invalid parameter

    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/parser.rb:610:in `process'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/parser.rb:30:in `parse'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/service.rb:67:in `post'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/session.rb:600:in `post_without_logging'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/session.rb:611:in `post'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/logging.rb:20:in `log_fb_api'
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/logging.rb:20:in `log_fb_api'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/session.rb:610:in `post'
    /Library/Ruby/Gems/1.8/gems/mmangino-facebooker-1.0.50/lib/facebooker/session.rb:198:in `secure!'
    ./config/frankie/lib/frankie.rb:66:in `secure_with_token!'
    ./config/frankie/lib/frankie.rb:44:in `set_facebook_session'
    ./config/frankie/lib/frankie.rb:164:in `ensure_authenticated_to_facebook'
    ./config/frankie/lib/frankie.rb:169:in `ensure_application_is_installed_by_facebook_user'

I've no idea why, it seems to be related with the auth token I guess..

I logged the request made o the fb rest server:

{:sig=>"4f244d1f510498f4efaae3c03d036a85", :generate_session_secret=>"0", :method=>"facebook.auth.getSession", :auth_token=>"9dae0d02c19c680b574c78d202b0582a", :api_key=>"70c14732815ace0ae71a561ea5eb38b7", :v=>"1.0"}

 {:call_id=>"1269003766.05665", :sig=>"194469457d1424dc8ba0678979692363", :method=>"facebook.photos.get", :subj_id=>750401957, :session_key=>"2.lXL0z3s4_r573xzQwAiA9A__.3600.1269010800-750401957", :api_key=>"70c14732815ace0ae71a561ea5eb38b7", :v=>"1.0"}


{:sig=>"4f244d1f510498f4efaae3c03d036a85", :generate_session_secret=>"0", :method=>"facebook.auth.getSession", :auth_token=>"9dae0d02c19c680b574c78d202b0582a", :api_key=>"70c14732815ace0ae71a561ea5eb38b7", :v=>"1.0"}

The last one gives the error, it could be related with auth_token having the same value in the 1st and on the 3rd ?

Cheers and tks, Ze Maria

A: 

Did you ever figure this out. Apparently if you are using iFrame, you can get the auth tken, however using FBML, facebook sends it overs as a post parameter, so you have to use post '/' as your index, not get '/'.

Sir Bertly