Skip to content

Example to avoid 404 after OmniAuth 2.0 upgrade #142

@osowskit

Description

@osowskit

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions