From a9294f801170385c12981e95268590c303ec63e1 Mon Sep 17 00:00:00 2001 From: Kendall Park Date: Fri, 17 Jun 2016 11:02:25 -0500 Subject: [PATCH] added bypass_sign_in for next version of Devise --- .../devise_token_auth/concerns/set_user_by_token.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 2f0f6bd1e..e025c7802 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 @@ -61,7 +61,12 @@ def set_user_by_token(mapping=nil) user = uid && rc.find_by_uid(uid) if user && user.valid_token?(@token, @client_id) - sign_in(:user, user, store: false, bypass: true) + # sign_in with bypass: true will be deprecated in the next version of Devise + if self.respond_to? :bypass_sign_in + bypass_sign_in(user, scope: :user) + else + sign_in(:user, user, store: false, bypass: true) + end return @resource = user else # zero all values previously set values