Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST, CORS and Turbo #34

Open
curtis741 opened this issue Jan 25, 2023 · 1 comment
Open

POST, CORS and Turbo #34

curtis741 opened this issue Jan 25, 2023 · 1 comment

Comments

@curtis741
Copy link

If your using Turbo, you might see this behavior when trying to follow the redirect from Omniauth:
image

Where the browser POST's to the Rails server, gets the 302 redirect to Okta but then fails on CORs verification. This happens when you are using Turbo in your rails app and to fix it you should make a login button like this:

<%= button_to "Login via Okta", user_okta_omniauth_authorize_path, method: :post, form: {"data-turbo" => "false"}%>

I figured this out by following what this comment said:
hotwired/turbo#45 (comment)

This might be worth putting in the readme as a weird gotcha?

@januszm
Copy link

januszm commented Mar 1, 2024

Life saver! PS. using the "new" (1.9 so not that new) Ruby syntax:

<%=
  button_to "Login via Okta", user_okta_omniauth_authorize_path, method: :post, data: { turbo: false }
%>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants