I’m working on a Rails 8 API application where I have separated API routes from my admin panel:
namespace :api do
get 'test', to: 'clerk_test#index'
end
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
I’m using Clerk JWT for API authentication, and my Contoller looks like this:
class Api::ClerkTestController < Api::BaseController
include Clerk::Authenticatable
before_action :index
def index
Rails.logger.info "ClerkTest#index called for user_id=#{clerk&.user_id}"
render json: { message: "Clerk test successful", user_id: clerk.user_id }
end
end
The issue:
- When I hit /api/test with random text in the Authorization header, it works as expected.
- When I hit /api/test with a valid JWT, I get the following error:
RuntimeError (No Failure App provided)
I think Warden/Devise is intercepting the request before it could reach the controller. How do I stop Warden/Devise to stop intercepting? I am using ActiveAdmin for admin authentications. I have tried with skip_before_action :authenticate_admin_user! if defined?(authenticate_admin_user!). But in vain.
devisein anyway please supply that information as well