diff --git a/app/controllers/kuroko2/api/application_controller.rb b/app/controllers/kuroko2/api/application_controller.rb index 097e94b5..6798f720 100644 --- a/app/controllers/kuroko2/api/application_controller.rb +++ b/app/controllers/kuroko2/api/application_controller.rb @@ -31,7 +31,7 @@ def respond_with_error(status_code, error_code, message) def api_authentication service_name = authenticate_with_http_basic do |name, api_key| stored = Kuroko2.config.api_basic_authentication_applications.try!(name.to_sym) - if Rack::Utils.secure_compare(api_key, stored) + if stored && Rack::Utils.secure_compare(api_key, stored) name.to_sym else nil