'Why is OmniAuth in my Rails app not seeing my requests?

I'm trying to set up OmniAuth for my existing Rails 6.1 app. At this stage, I'm just hoping to us the :developer strategy. However, when I browse to http://localhost:3000/auth/developer, I get a RoutingError instead of OmniAuth taking over like I expect.

My initializer looks like this:

SETUP_PROC = lambda { |env|
  Rails.logger.debug("This is the setup proc")
}

Rails.application.config.middleware.use OmniAuth::Builder do
  Rails.logger.debug("I am outside the configure block")
  configure do |conf|
    Rails.logger.debug("I am inside the configure block")
    Rails.logger.debug("conf.path_prefix is: #{conf.path_prefix}")
  end

  before_request_phase do
    Rails.logger.debug("This is before the request phase")
  end

  before_options_phase do
    Rails.logger.debug("This is before the options phase")
  end

  provider(:developer, :setup => SETUP_PROC)
end

When I start the server (or console) I see the log messages

I am outside the configure block
I am inside the configure block
conf.path_prefix is: /auth

…but visiting /auth/developer just sends me straight to the Rails routes — I don't get any of the other log messages. /auth/developer/setup doesn't print any other log messages, either.

I am totally baffled here. Is there anything I can do to find out what the omniauth middleware is doing, and why it's doesn't seem to be capturing requests to /auth?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source