jriff
jriff

Reputation: 1977

Rails 7: OmniAuth Route Not Recognized alongside Devise

I'm facing an issue integrating OmniAuth independently alongside Devise in a Rails 7 app. Devise with OmniAuth for user sign-in works perfectly. However, I am trying to enable connections to other external accounts (specifically Basecamp) to fetch data via their API, not for sign-in.

I have set up an initializer for OmniAuth as follows:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :basecamp, Rails.application.credentials.omniauth.basecamp[:public_key], Rails.application.credentials.omniauth.basecamp[:private_key]
end

After restarting the server, when I navigate to /auth/basecamp, I encounter a routing error: "No route matches [GET] '/auth/basecamp'". This error persists whether I try POST or GET.

Here’s a snippet of my middleware stack:

$ rails middleware
use Rack::Sendfile
use ActionDispatch::Static
use ActionDispatch::Executor
use ActionDispatch::ServerTiming
use ActiveSupport::Cache::Strategy::LocalCache::Middleware
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use ActionDispatch::RemoteIp
use Sprockets::Rails::QuietAssets
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use WebConsole::Middleware
use ActionDispatch::DebugExceptions
use ActionDispatch::ActionableExceptions
use ActionDispatch::Reloader
use ActionDispatch::Callbacks
use ActiveRecord::Migration::CheckPending
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ContentSecurityPolicy::Middleware
use ActionDispatch::PermissionsPolicy::Middleware
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Rack::TempfileReaper
use Warden::Manager
use OmniAuth::Builder
use OmniAuth::Strategies::Heroku
use Jumpstart::AccountMiddleware
run JumpstartApp::Application.routes

It appears OmniAuth::Builder is loaded, but it seems non-responsive to /auth/basecamp. Devise is configured in the application but not using Basecamp as a provider.

Could Devise be interfering even if it's not configured to handle Basecamp? Any insights or suggestions would be appreciated!

Upvotes: 1

Views: 107

Answers (0)

Related Questions