From 3dd981ca05ea0a9cff669b806e439379d339d270 Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Fri, 9 Nov 2018 17:49:23 +0100 Subject: [PATCH] Use logged in user (spree_current_user) for API authentication (current_api_user) --- app/controllers/api/base_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index a7f96d01cf..0187315d89 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -13,5 +13,13 @@ module Api def respond_with_conflict(json_hash) render json: json_hash, status: :conflict end + + private + + # Use logged in user (spree_current_user) for API authentication (current_api_user) + def authenticate_user + @current_api_user = try_spree_current_user + super + end end end