Devise doesn't redirect properly to stored location when using omniauth provider like facebook

后端 未结 1 1478
孤城傲影
孤城傲影 2020-12-08 12:14

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

相关标签:
1条回答
  • 2020-12-08 12:47

    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
    
    0 讨论(0)
提交回复
热议问题