How do I configure / omniauth to redirect to the page I signed up with?

I have authentication through omniauth, and this link is available on every page through layout / application.html.haml.

However, when they complete omniauth authentication, they all go to root.

How can I configure it to be redirected to the actual page from which they clicked on the authentication link (which passes them to the oauth provider).

thank

+3
source share
2 answers

You can use request.env['omniauth.origin'].

See https://github.com/intridea/omniauth/wiki/Saving-User-Location

+10
source

Here I see two options:

1) , :

session[:return_to] = request.fullpath

:

redirect_to session[:return_to]

2)

redirect_to :back

, ( omniauth, )

+5

All Articles