# Not able to be redirected to login page on brand new Rails 7 application

**URL:** <https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144>\
**Category:** Get Help\
**Tags:** rails, login, auth0\
**Created:** [May 26, 2022, 10:54pm UTC](https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144 "2022-05-26T22:54:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dylan-hoefsloot](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dylan-hoefsloot/32/34604_2.png) [@dylan-hoefsloot](https://community.auth0.com/u/dylan-hoefsloot)\
**Post date:** [May 26, 2022, 10:54pm UTC](https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144/1 "2022-05-26T22:54:12Z")

</div>

Please include the following information in your post:

- Which SDK this is regarding: [omniauth-auth0](https://github.com/auth0/omniauth-auth0)
- SDK Version: 3.0.0
- Platform Version: Ruby 3.1.2 and Rails 7.0

I have followed the official guide [here](https://auth0.com/docs/quickstart/webapp/rails/01-login) to setup Auth0 on a completely new project with Rails 7.

I have the following button

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

```

When I click login, I see the page load for second but nothing happens, this is all that is logged.

```auto
INFO -- : Started POST "/auth/auth0" for ::1 at 2022-05-27 10:16:41 +1200
DEBUG -- omniauth: (auth0) Request phase initiated.

```

I have the same issue whether running on my machine or in docker, I had recently followed the same article to add Auth0 to an existing Rails 6 application without any trouble.

It seems logout works fine as I get this in the logs

```auto
INFO -- : Started GET "/auth/logout" for ::1 at 2022-05-27 10:48:29 +1200
INFO -- : Processing by Auth0Controller#logout as HTML
INFO -- : Redirected to *redacted_auth0_logout_address*
INFO -- : Completed 302 Found in 1ms (Allocations: 509)

```

I tried changing the auth0 credentials and address to see if this made any difference (purposefully making them incorrect) but this doesn’t make a difference as it doesn’t seem I am getting that far to be redirected to Auth0.

I checked the FAQ [here](https://auth0.com/docs/quickstart/webapp/rails/02-troubleshooting) but it didn’t help as I am not getting any errors.

Is there any extra debugging information I can enable?

---

<div class="post-metadata">

**Author:** ![shaunakv1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shaunakv1/32/38145_2.png) [@shaunakv1](https://community.auth0.com/u/shaunakv1)\
**Post date:** [November 22, 2022, 3:35am UTC](https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144/2 "2022-11-22T03:35:02Z")

</div>

I have the same problem with Rails 7. The login button doesn’t work. However if I duplicate the button it does work sometimes. I believe it’s something to do with the turbo library, but don’t have a solution yet

---

<div class="post-metadata">

**Author:** ![r3cha](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/r3cha/32/34166_2.png) [@r3cha](https://community.auth0.com/u/r3cha)\
**Post date:** [January 2, 2023, 5:42pm UTC](https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144/3 "2023-01-02T17:42:05Z")

</div>

Disable turbo `<%= button_to 'Login', '/auth/auth0', 'data-turbo': 'false' ,method: :post %>`

---

<div class="post-metadata">

**Author:** ![pavan.kumar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/pavan.kumar/32/46670_2.png) [@pavan.kumar](https://community.auth0.com/u/pavan.kumar)\
**Post date:** [April 26, 2023, 10:18am UTC](https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144/4 "2023-04-26T10:18:58Z")

</div>

Facing Same Issue here did you find any solution?

It works with their project (repo mentioned in quick start guid for rails) correctly, but it doesn’t work in my project.

---

<div class="post-metadata">

**Author:** ![carlastabile](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/carlastabile/32/54630_2.png) [@carlastabile](https://community.auth0.com/u/carlastabile)\
**Post date:** [March 5, 2024, 12:06pm UTC](https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144/5 "2024-03-05T12:06:22Z")

</div>

Hello! Can you try disabling turbo and passing the prompt parameter as well? As @r3cha mentioned it seems to be an issue with turbo.

```auto
<%= button_to 'Log In', '/auth/auth0', params: {prompt: 'login'}, data: {turbo: "false"} %>

```

One of the features of Turbo consists of converting links form submissions into AJAX requests, which is supposed to speed up your applications thanks to [Turbo Drive](https://turbo.hotwired.dev/handbook/introduction#turbo-drive%3A-navigate-within-a-persistent-process). In this case you’ll want to disable Turbo for the buttons’ form, so it’s not an AJAX request.

It’s also useful to pass the `prompt: 'login'` parameter to the `authorize` endpoint so Auth0 can offer a better experience. More info: [Rails Authentication By Example](https://developer.auth0.com/resources/guides/web-app/rails/basic-authentication#add-user-login-to-rails)

Let me know if this works!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 15, 2024, 9:33pm UTC](https://community.auth0.com/t/not-able-to-be-redirected-to-login-page-on-brand-new-rails-7-application/84144/6 "2024-11-15T21:33:21Z")

</div>

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