2

Relatively simple question here but I can't seem to figure it out. I have an application where the user submits a get request and is then given a page with results. On this page, the user can login to facebook to interact with the results (rate, comment etc). However, how do I connect the user to facebook and keep him on the same page. (I cant just refresh with the get query in the url because the page returns something different every time.)

In other words, given this code from the facebooker2 github:

<%= fb_connect_async_js %>
<% if current_facebook_user %>
  <%= "Welcome #{current_facebook_user.first_name} #{current_facebook_user.last_name}!" %>
  or 
  <%= "Hello #{fb_name(current_facebook_user, :useyou => false)}!" # link to facebook profile %>
  <%= fb_logout_link("Logout of fb", request.url) %><br />
<% else
   # you must explicitly request permissions for facebook user fields.
   # here we instruct facebook to ask the user for permission for our website
   # to access the user's facebook email and birthday
   %>
  <%= fb_login_and_redirect('<your URL here>', :perms => 'email,user_birthday') %>
<% end %>

How can I not redirect the user to another page (url is blank), and have the first part of the if statement automatically execute once the user signs into facebook.

MEURSAULT
  • 8,307
  • 4
  • 24
  • 23

0 Answers0