I am trying to use link_to_remote to send ajax request to my server, where my code looks like: <%= link_to_remote( image_tag(?image?), :update => div_id, :url => my_url(post, :canvas => false), :method => :get, :html => {:class => ?button?}, :before => ?$(?spinner?).show()?, :complete => ?$(?spinner?).hide()? ) %> However, since canvas is false, facebook doesn?t send authorization the facebooker filters rejects the request with 401 error. I don?t want to skip ensure_authenticated_to_facebook filter, but how do I fix this? Thanks. -Shahzad -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090103/59a15c50/attachment.html>
Tres Wong-Godfrey
2009-Jan-03 22:26 UTC
[Facebooker-talk] link_to_remote with 401 error code
link_to_remote doesn''t work with Facebooker. You can use remote_form_for and some CSS magic to get the same outcome. On Jan 3, 2009, at 1:15 PM, shahzad bhatti wrote:> I am trying to use link_to_remote to send ajax request to my server, > where my code looks like: > > > > <%= link_to_remote( image_tag(?image?), :update => div_id, :url => > my_url(post, :canvas => false), :method => :get, :html => {:class => > ?button?}, :before => ?$(?spinner?).show()?, :complete => ?$ > (?spinner?).hide()? ) %> > > > > > > However, since canvas is false, facebook doesn?t send authorization > the facebooker filters rejects the request with 401 error. I don?t > want to skip ensure_authenticated_to_facebook filter, but how do I > fix this? > > Thanks. > > > > -Shahzad > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
link_to_remote works just fine. You need to make sure that the URL you are hitting is a fully qualified url since the facebook API doesn''t play nice with AJAX calls. The URL should be hitting your app directly. On Sat, Jan 3, 2009 at 5:26 PM, Tres Wong-Godfrey < tres.wong-godfrey at saniq.com> wrote:> > link_to_remote doesn''t work with Facebooker. You can use remote_form_for > and some CSS magic to get the same outcome. > > > > On Jan 3, 2009, at 1:15 PM, shahzad bhatti wrote: > > I am trying to use link_to_remote to send ajax request to my server, where >> my code looks like: >> >> >> >> <%= link_to_remote( image_tag("image"), :update => div_id, :url => >> my_url(post, :canvas => false), :method => :get, :html => {:class => >> "button"}, :before => "$(''spinner'').show()", :complete => >> "$(''spinner'').hide()" ) %> >> >> >> >> >> >> However, since canvas is false, facebook doesn''t send authorization the >> facebooker filters rejects the request with 401 error. I don''t want to skip >> ensure_authenticated_to_facebook filter, but how do I fix this? >> >> Thanks. >> >> >> >> -Shahzad >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090103/997d5be9/attachment.html>
Tres Wong-Godfrey
2009-Jan-04 01:48 UTC
[Facebooker-talk] link_to_remote with 401 error code
link_to_remote works -- in the sense that it will pass data to the server; however, the parameters for the original question were to use Facebook authentication. Your solution bypasses the Facebook AJAX proxy and also authentication -- which I believe the original question already implies knowledge of. If you can use link_to_remote through Facebook''s AJAX proxy, then this is something new & I was unable to use during months of development with facebooker. On Jan 3, 2009, at 4:39 PM, Josh Sharpe wrote:> link_to_remote works just fine. You need to make sure that the URL > you are hitting is a fully qualified url since the facebook API > doesn''t play nice with AJAX calls. The URL should be hitting your > app directly. > > On Sat, Jan 3, 2009 at 5:26 PM, Tres Wong-Godfrey <tres.wong-godfrey at saniq.com > > wrote: > > link_to_remote doesn''t work with Facebooker. You can use > remote_form_for and some CSS magic to get the same outcome. > > > > On Jan 3, 2009, at 1:15 PM, shahzad bhatti wrote: > > I am trying to use link_to_remote to send ajax request to my server, > where my code looks like: > > > > <%= link_to_remote( image_tag("image"), :update => div_id, :url => > my_url(post, :canvas => false), :method => :get, :html => {:class => > "button"}, :before => "$(''spinner'').show()", :complete => "$ > (''spinner'').hide()" ) %> > > > > > > However, since canvas is false, facebook doesn''t send authorization > the facebooker filters rejects the request with 401 error. I don''t > want to skip ensure_authenticated_to_facebook filter, but how do I > fix this? > > Thanks. > > > > -Shahzad > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
Link to remote with a direct server path used to use the facebook proxy. Facebook would re-write the request to go through their servers. It would then include the sig parameters. You can call facebook_session_parameters to get a list of those params for inclusion in your URL. Mike On Jan 3, 2009, at 8:48 PM, Tres Wong-Godfrey wrote:> > link_to_remote works -- in the sense that it will pass data to the > server; however, the parameters for the original question were to > use Facebook authentication. Your solution bypasses the Facebook > AJAX proxy and also authentication -- which I believe the original > question already implies knowledge of. > > If you can use link_to_remote through Facebook''s AJAX proxy, then > this is something new & I was unable to use during months of > development with facebooker. > > > > On Jan 3, 2009, at 4:39 PM, Josh Sharpe wrote: > >> link_to_remote works just fine. You need to make sure that the URL >> you are hitting is a fully qualified url since the facebook API >> doesn''t play nice with AJAX calls. The URL should be hitting your >> app directly. >> >> On Sat, Jan 3, 2009 at 5:26 PM, Tres Wong-Godfrey <tres.wong-godfrey at saniq.com >> > wrote: >> >> link_to_remote doesn''t work with Facebooker. You can use >> remote_form_for and some CSS magic to get the same outcome. >> >> >> >> On Jan 3, 2009, at 1:15 PM, shahzad bhatti wrote: >> >> I am trying to use link_to_remote to send ajax request to my >> server, where my code looks like: >> >> >> >> <%= link_to_remote( image_tag("image"), :update => div_id, :url => >> my_url(post, :canvas => false), :method => :get, :html => {:class >> => "button"}, :before => "$(''spinner'').show()", :complete => "$ >> (''spinner'').hide()" ) %> >> >> >> >> >> >> However, since canvas is false, facebook doesn''t send authorization >> the facebooker filters rejects the request with 401 error. I don''t >> want to skip ensure_authenticated_to_facebook filter, but how do I >> fix this? >> >> Thanks. >> >> >> >> -Shahzad >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com