Hi all! Quick question. In this section of the guide, there’s a short list of ActionController modules that can be optionally added back in to API-only apps. But when I try to include
the module for HTTP Basic Authentication, Rails is throwing a 404 error.
ApplicationController:
class ApplicationController < ActionController::API
include ActionController::HttpAuthentication::Basic
...
end
Test controller:
class TestController < ApplicationController
http_basic_authenticate_with name: "asdf", password: "password"
...
end
If I switch
ApplicationController < ActionController::API
to
ApplicationController < ActionController::Base
then the http_basic_authenticate_with
method works properly. But when it inherits from ActionController::API
, I get the error:
#<ActionController::RoutingError: undefined method 'http_basic_authenticate_with' ...
Do I need to include that module in a different way?