I''m working on the ability to share a single session between Facebook and Non-Facebook requests. Right now, to setup a shared session, you create a link like: <%= link_to "Non-Facebook view",leaders_url(facebook_session_parameters.merge(:canvas=>false))%> The facebook_session_parameters includes all of the necessary info. Is this okay, or would it be better as <%= link_to "Non-Facebook view",leaders_url(:canvas=>false,:share_session=>true)%> I hate to complicate our url_rewriting any more than we have to. Is the :share_session_approach cleaner? Mike -- Mike Mangino http://www.elevatedrails.com
Hey Mike, Is there anyway that we can make the assumption that if we are currently in the context of a facebook session then we would want to ''share'' that session with external requests? Then we could pass a :ignore_facebook_session => true if we don''t want the default behavior? Then we won''t have special cases checking if you should create a url that shares the session or not. For me , I have a bunch of code that I wrote in order to support an external application as an iframed application within facebook. I did this by continually passing the fb_sig_session_key and rewriting ''url_for'' whenever I was in context of a facebook session. Here is the code I am currently using: def url_for(options, *parameters_for_method_reference) if(options && (Hash === options) && context?(:facebook) ) options = options.merge(:context => ''facebook'', :fb_sig_session_key => params[:fb_sig_session_key]) end url = (String === options ) ? options : super return url end Dave On Jan 28, 2008 1:04 PM, Mike Mangino <mmangino at elevatedrails.com> wrote:> I''m working on the ability to share a single session between Facebook > and Non-Facebook requests. Right now, to setup a shared session, you > create a link like: > > <%= link_to "Non-Facebook > view",leaders_url(facebook_session_parameters.merge(:canvas=>false))%> > > The facebook_session_parameters includes all of the necessary info. Is > this okay, or would it be better as > > <%= link_to "Non-Facebook > view",leaders_url(:canvas=>false,:share_session=>true)%> > > I hate to complicate our url_rewriting any more than we have to. Is > the :share_session_approach cleaner? > > Mike > > -- > Mike Mangino > http://www.elevatedrails.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >
The beauty of the current Facebooker stuff is that it only has to happen once. If we include it the first time on external links, Rails will do the right thing afterwards. It seems a little gross to constantly include that link on every :canvas=>false link. Or do others agree with David? Mike On Jan 28, 2008, at 3:22 PM, David Clements wrote:> Hey Mike, > > Is there anyway that we can make the assumption that if we are > currently in the context of a facebook session then we would want to > ''share'' that session with external requests? Then we could pass a > :ignore_facebook_session => true if we don''t want the default > behavior? > > Then we won''t have special cases checking if you should create a url > that shares the session or not. > > For me , I have a bunch of code that I wrote in order to support an > external application as an iframed application within facebook. I did > this by continually passing the fb_sig_session_key and rewriting > ''url_for'' whenever I was in context of a facebook session. > > Here is the code I am currently using: > > def url_for(options, *parameters_for_method_reference) > if(options && (Hash === options) && context?(:facebook) ) > options = options.merge(:context => ''facebook'', > :fb_sig_session_key => params[:fb_sig_session_key]) > end > url = (String === options ) ? options : super > return url > end > > Dave > > > > On Jan 28, 2008 1:04 PM, Mike Mangino <mmangino at elevatedrails.com> > wrote: >> I''m working on the ability to share a single session between Facebook >> and Non-Facebook requests. Right now, to setup a shared session, you >> create a link like: >> >> <%= link_to "Non-Facebook >> view",leaders_url(facebook_session_parameters.merge(:canvas=>false)) >> %> >> >> The facebook_session_parameters includes all of the necessary info. >> Is >> this okay, or would it be better as >> >> <%= link_to "Non-Facebook >> view",leaders_url(:canvas=>false,:share_session=>true)%> >> >> I hate to complicate our url_rewriting any more than we have to. Is >> the :share_session_approach cleaner? >> >> Mike >> >> -- >> Mike Mangino >> http://www.elevatedrails.com >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >>-- Mike Mangino http://www.elevatedrails.com
I agree with you that the urls become ugly for sure, and I don''t really like leaking the session key out on the URL''s. So I see both sides of it. If it isn''t the default then I will leave my url_for hack in place to keep things less obtrusive for the IFramed app case. There is one issue that I came across when doing this in IFrames. Safari will not set the session cookie for you until the user takes some action within the IFrame. So for me I had to add that url_for hack to all my links so that the session key would be passed along to "whatever" the next action the user took. I will say this as an aside. Being able to keep the facebooker session alive as our users click all around our app within an iframe made a one month task of porting the app to facebook into a 1 week task of reworking the CSS to fit in that little box. So hurray!! for Facebooker. Dave On Jan 28, 2008 3:28 PM, Mike Mangino <mmangino at elevatedrails.com> wrote:> The beauty of the current Facebooker stuff is that it only has to > happen once. If we include it the first time on external links, Rails > will do the right thing afterwards. It seems a little gross to > constantly include that link on every :canvas=>false link. Or do > others agree with David? > > Mike > > > On Jan 28, 2008, at 3:22 PM, David Clements wrote: > > > Hey Mike, > > > > Is there anyway that we can make the assumption that if we are > > currently in the context of a facebook session then we would want to > > ''share'' that session with external requests? Then we could pass a > > :ignore_facebook_session => true if we don''t want the default > > behavior? > > > > Then we won''t have special cases checking if you should create a url > > that shares the session or not. > > > > For me , I have a bunch of code that I wrote in order to support an > > external application as an iframed application within facebook. I did > > this by continually passing the fb_sig_session_key and rewriting > > ''url_for'' whenever I was in context of a facebook session. > > > > Here is the code I am currently using: > > > > def url_for(options, *parameters_for_method_reference) > > if(options && (Hash === options) && context?(:facebook) ) > > options = options.merge(:context => ''facebook'', > > :fb_sig_session_key => params[:fb_sig_session_key]) > > end > > url = (String === options ) ? options : super > > return url > > end > > > > Dave > > > > > > > > On Jan 28, 2008 1:04 PM, Mike Mangino <mmangino at elevatedrails.com> > > wrote: > >> I''m working on the ability to share a single session between Facebook > >> and Non-Facebook requests. Right now, to setup a shared session, you > >> create a link like: > >> > >> <%= link_to "Non-Facebook > >> view",leaders_url(facebook_session_parameters.merge(:canvas=>false)) > >> %> > >> > >> The facebook_session_parameters includes all of the necessary info. > >> Is > >> this okay, or would it be better as > >> > >> <%= link_to "Non-Facebook > >> view",leaders_url(:canvas=>false,:share_session=>true)%> > >> > >> I hate to complicate our url_rewriting any more than we have to. Is > >> the :share_session_approach cleaner? > >> > >> Mike > >> > >> -- > >> Mike Mangino > >> http://www.elevatedrails.com > >> > >> _______________________________________________ > >> Facebooker-talk mailing list > >> Facebooker-talk at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/facebooker-talk > >> > > -- > Mike Mangino > http://www.elevatedrails.com > >