Ruby in Rails -- Redirect to Login


I have been following the tutorial for using Auth0 with Rails here

The issue I have is that most Rails applications (and ours is one of them) , if I hit a URL that needs a login, it will redirect me to the login screen, and then upon successful authentication continue on it’s merry journey.

I haven’t found anything in the documentation about how to do that redirect?

I have had to construct a URL myself … that seems to work … but it’s been a bit of trial and error and I would have thought that there was a better Rails way.

state = SecureRandom.hex
session['omniauth.state'] =  state
callback_url = auth_auth0_callback_url
url = "https://#{ApplicationConfig::Auth0::DOMAIN}/authorize?response_type=code&client_id=#{ApplicationConfig::Auth0::CLIENT_ID}&redirect_uri=#{callback_url}&state=#{state}&scope=openid profile email"

So is there a better way of doing this?


Hey there Shane!

It would be best if you open a GitHub issue in the quickstart repo so the quickstart maintainers can address that directly for you. Make sure to share the link to it here with us so we can ping them. Thanks!

Hi Konrad

I submitted an issue as you suggested.


1 Like

but you should have opened it here:

as this is the repo for the quickstart you use.

Share the link to the issue once you have it and please the previous one you opened in another repo.

Ok, Here is issue

1 Like

Thank you! I will ping repo maintainers in a few minutes!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.