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

Example to avoid 404 after OmniAuth 2.0 upgrade #142

Open
osowskit opened this issue Mar 9, 2021 · 1 comment
Open

Example to avoid 404 after OmniAuth 2.0 upgrade #142

osowskit opened this issue Mar 9, 2021 · 1 comment

Comments

@osowskit
Copy link

osowskit commented Mar 9, 2021

Spent some time researching why upgrading broke this login flow. With the CSFR mitigation in 2.0, the GET /auth/twitter endpoint no longer is supported.

Adding OmniAuth.config.allowed_request_methods = [:get] is a temp workaround for the upgrade but it's better to support the POST method. Could you add a simple example (for sinatra/rack) for this?

reference

get '/' do
  <<~HTML
       <form method='post' action='/auth/twitter'>
         <input type="hidden" name="authenticity_token" value='#{request.env["rack.session"]["csrf"]}'>
         <button type='submit'>Login with Twitter</button>
       </form>
  HTML
end
@angezanetti
Copy link

I had the same issue, I installer this gem omniauth-rails_csrf_protection to update the link to POST ones.

Not super clean, but works

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