I have in my app some actions which are protected and need user authentication. Since I\'m using devise, I use authenticate_user! before filter to protect them. Whenever use
We use Facebook JS to get the access code which then returns back to the omniauth_callback_controller.rb and signs the user in.
I found that the origin URL is saved in the request. Worked a treat for us.
in application_controller.rb
def after_sign_in_path_for(resource_or_scope)
if request.env['omniauth.origin']
request.env['omniauth.origin']
end
end