Railsドキュメント

Basic認証

適応バージョン

説明

Basic認証

使い方

http_basic_authenticate_with(name: 名前, password: パスワード, realm: 認証が必要がエリア名=nil, オプション引数)

http_basic_authenticate_with name: ENV['BASIC_AUTH_USERNAME'], password: ENV['BASIC_AUTH_PASSWORD'] if Rails.env == 'staging'

ソースコード