Wilhelm Chung
2008-Mar-11 22:01 UTC
[Facebooker-talk] How to get a facebook session for desktop applications (or unit tests?)
Normally, in a rails app, all one would have to do is call set_facebook_session, or the ensure_* filters to get a valid session. I''ve been looking through the sessions code to figure out how to get a valid session for desktop applications (or unit tests)--basically outside of rails controller. As far as I can ascertain, you should just be able to do this: require ''facebooker'' sess = Facebooker::Session.create sess.secure! Since secure! calls auth_token to get authentication token on its own if it hadn''t already. But instead this throws a Facebooker::Session::MissingOrInvalidParameter: => #<Facebooker::Session:0xb66756e0 @secret_key="829bbe2f0255043cc906b064a9239c07", @api_key="98519f7e0ed4e6e8ad01bfb2864c1e3c">>> sess.secure!Facebooker::Session::MissingOrInvalidParameter: Invalid parameter from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/parser.rb:386:in `process'' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in `parse'' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/service.rb:13:in `post'' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/session.rb:398:in `post'' from /home/wil/proj/3cgworkspace/mobtropolis/vendor/plugins/facebooker/lib/facebooker/session.rb:137:in `secure!'' from (irb):14 I think I''m missing something fundamental. I''ve looked through the fb developer docs and the facebooker code, but I"m coming up short. Can anyone set me straight? Thanks. Wilhelm -- http://webjazz.blogspot.com http://www.mobtropolis.com http://www.3cglabs.com