Here’s an example of Basic Authentication with Rails :
class ApplicationController < ActionController::Base
before_action :basic_authentication if Rails.env.production?
private
def basic_authentication
authenticate_or_request_with_http_basic do |user, password|
user == [USER NAME] && password == [PASSWORD]
end
end
end