From 668dbaa8884da791550715963a708e52166b8dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miika=20Lepp=C3=A4nen?= Date: Fri, 8 Jul 2016 13:59:57 +0300 Subject: [PATCH] Fix for issue #600 Method set_user_by_token is called(from current_user) after SessionController create action and @client_id was set to nil. --- .../devise_token_auth/concerns/set_user_by_token.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb index e025c7802..17f28c202 100644 --- a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +++ b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb @@ -30,8 +30,8 @@ def set_user_by_token(mapping=nil) # parse header for values necessary for authentication uid = request.headers[uid_name] || params[uid_name] - @token = request.headers[access_token_name] || params[access_token_name] - @client_id = request.headers[client_name] || params[client_name] + @token ||= request.headers[access_token_name] || params[access_token_name] + @client_id ||= request.headers[client_name] || params[client_name] # client_id isn't required, set to 'default' if absent @client_id ||= 'default'