auth0 / omniauth-auth0

OmniAuth strategy to login with Auth0
MIT License
125 stars 67 forks source link

Auth0 Login Button does nothing in Rails 7 unless Turbo is disabled #155

Closed shaunakv1 closed 1 year ago

shaunakv1 commented 1 year ago

Describe the problem

After following the setup instructions for Rails and adding the button. The button does nothing. Note that I have a fully functional rails 5 application that works just fine with exact same code. May be the documentation needs to reflect this?

<%= button_to 'Login', '/auth/auth0', method: :post %>

However this works just fine:

<%= button_to "Login", "/auth/auth0", method: :post, data: { turbo: false } %>

What was the expected behavior?

Expected to redirect to Auth0 Login page

Where possible, please include: Without turbo:false all I get in logs is:

web    | Started POST "/auth/auth0" for ::1 at 2022-11-21 22:58:24 -0500
web    | D, [2022-11-21T22:58:24.501212 #45225] DEBUG -- omniauth: (auth0) Request phase initiated.

Environment

TastyPi commented 1 year ago

This is more an issue with Turbo than this gem. Turbo doesn't handle redirects to external URLs properly, so it breaks when /auth/auth0 tries to redirect to Auth0. There's a discussion about it here https://github.com/hotwired/turbo/issues/401. Since /auth/auth0 isn't expected to fail, it's safe to just disable Turbo for it.

stevehobbsdev commented 1 year ago

Thanks for chiming in @TastyPi!