views:

78

answers:

1

Hi.

Everything seems to be working fine with my implementation of Facebooker with Authlogic (using the authlogic_facebook_connect plugin) except for one thing.

After the initial authorization of the application (by clicking OK on the Facebook pop-up) I still remain on the login page. There is no redirection. However, once I refresh the login page and then click the Facebook button again, there is no popup because it is already authorized by Facebook, instead it redirects to /user_session (for authentication via Facebook session) automatically and immediately takes me to the dashboard page as expected.

Additional Information:

Any idea why it doesn't redirect on the very first click, right after authorizing Facebook? The post-authorize URL is set for http:///user_session/ and the routes for authlogic are set properly.

I have tried with Prototype and jQuery, both give the same results.

You can see the same issue on this tutorial website if you try to authenticate with Facebook. This website is not mine so try at your own risk: http://facebooker.pjkh.com

Thanks.

A: 

Also having the same issue here. I think the reason it was doing nothing for me, using jquery, is the code generated by

<%= authlogic_facebook_login_button :controller => 'customer_session' %>

which is something like

  <form id='connect_to_facebook_form' method='post' action='/customer_session'>
    <input type='hidden' name='authenticity_token' value='keLV8CIfc5znsRkjhkjhkjhkjhkjh='/>
  </form>
  <script type='text/javascript' charset='utf-8'>
    function connect_to_facebook() {
      $('connect_to_facebook_form').submit();
    }
  </script>
  <fb:login-button js="prototype" onlogin="connect_to_facebook()"></fb:login-button>

the jquery to submit the form is wrong it should be

$('#connect_to_facebook_form').submit();

(duh, because I did not pass in :js => :jquery)

but if I fix that I still get

1 error prohibited this customer session from being saved

There were problems with the following fields:

* You did not provide any details for authentication

so the right details are not being injected into the form I guess

Pauly
Fixed now, removing site domain from my app settings on facebook itself made it send the correct details through...
Pauly