Today I Learned

A Hashrocket project

Preserve params between omniauth req & callbacks

If you need to pass a param to omniauth callbacks so that you can maintain a certain state about the user signing in you can do the following:

In the url call to omniauth provider strategy add a querystring:

<a href="/users/auth/facebook?mobile=true">Sign In with Facebook</a>

Then to retrieve it on the callback url handler:

request.env['omniauth.params']['mobile']
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.