From 1fba3b98be895e5124e8c7a80fc1ca621d6b0dcf Mon Sep 17 00:00:00 2001 From: benji Date: Sat, 12 Sep 2015 10:51:37 +0200 Subject: [PATCH] Use http authorization to place api key --- app/controllers/application_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 44864a9..9a598e9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,8 +15,9 @@ class ApplicationController < ActionController::Base end def current_client - Client.find_by key: request.headers.inspect.to_s - @current_client ||= Client.find_by key: (request.headers["X_API_KEY"] || request.headers["HTTP_X_API_KEY"]) + @current_client ||= authenticate_with_http_token do |token, options| + Client.find_by key: token + end end def current_ability