omniauth: Developer provider not working under Rails 7.0.2.3

Please complete all sections.

Configuration

  • Provider Gem: omniauth-2.0.4
  • Ruby Version: 2.7.5
  • Framework: rails 7.0.2.3
  • Platform: ubuntu

Expected Behavior

Gemfile

gem 'omniauth'
gem "omniauth-rails_csrf_protection"

config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :developer
end

app/views/sessions/new.html.erb

<%= form_tag('/auth/developer', method: 'post') do %>
  <button type='submit'>Login with Developer</button>
<% end %>

Clicking on Login should render the developer form and log you in using fake credentials.

Actual Behavior

The only thing in the log is:

Started POST "/auth/developer" for 127.0.0.1 at 2022-03-21 21:58:57 +0100
D, [2022-03-21T21:58:57.950088 #3941647] DEBUG -- : (developer) Request phase initiated.

So the middleware is hit, but there is nothing after this.

Steps to Reproduce

gem install rails --version 7.0.2.3 rails new --css bootstrap Add the code in expected behaviour. bundle install rails s click Login

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I think this might be the new turbo links being strange. Changed the view to:

<%= form_tag('/auth/developer', method: 'post', data: {turbo: false}) do %>
  <button type='submit'>Login with Developer</button>
<% end %>

Then that seems to work.

I’d just like to add that you don’t have to use a form_tag, you can just use a button_to:

<%= button_to "Sign in with Github", "/auth/github", data: { turbo: false } %>