0

When the user installs my facebook app for the first time, a facebook logo is displayed, permissions are requested, and then the user is popped out of the iframe.

I applied the directions recently (Oct 14th) added to the OmniAuth Overview wiki page on the devise site regarding lost sessions. And this has fixed all my redirect issues except when the permissions dialog shows up.

Anyone else seeing this? Any idea how to fix? Help!

Liana
  • 286
  • 3
  • 5

1 Answers1

0

Figured it out on my own.

The OmniAuth Overview wiki page suggests the fix below in application_controller.rb to fix lost sessions:

def authenticate_user!
  if !current_user
    # This should work, but session is lost. 
    # session[:return_to] = request.fullpath
    redirect_to user_omniauth_authorize_path(:google_apps, :origin => request.fullpath)
  end
end

But instead of using request.fullpath in the snippet above, the key is to use request.env["HTTP_REFERER"] instead.