Jeremy B
Jeremy B

Reputation: 911

Passing params through omniauth and facebook connect

I am trying to pass a params to omniauth callback but I am having issues. When the user choose to signup onto my website he has to choose if he is an adult on a teen then the signup form is displayed. If he choose to go with with facebook connect, after he click on facebook connect the signup form is displayed on the callback page but with all the field filled with his info except for the password. I would also like to retrieve his adult/teen choice but don't really know how to do it. I am using devise with omniauthable and here is what I did :

Facebook Connect link :

<%= link_to image_tag("connect-w-facebook.jpg", alt: "Connect with Facebook"),      omniauth_authorize_path(:user,:facebook,{var: 'adult'}), :id =>"logo", :class =>'connect-face- img'  %>

So I hard coded the variable for now to test how it's working. On my callback page I have :

  <%= debug request.env['omniauth.auth'] %>
  <%= debug request.env['omniauth.params'] %>

These two are nul and don't display anything except --- ... for these two field... Thanks,

Upvotes: 0

Views: 396

Answers (1)

Jeremy B
Jeremy B

Reputation: 911

Well I was able to solve it by adding in the omniauth_callback_controller :

session[:omniauth] = request.env["omniauth.params"]

And by retrieving in my views <%= session[:omniauth] %>

Upvotes: 1

Related Questions