Reputation: 1772
I've added redis-rb to my rails 5 application in order to take care of backend processes managed by sidekiq.
User auth in my app is managed by Devise.
After getting all my workers etc. to function correctly, it seems that my session store is now broken. The problem is that when I sign out, the user session is not destroyed any longer, thus making it impossible to sign out.
Here is my session_store.rb config:
if Rails.env.production?
Rails.application.config.session_store :cookie_store, key: '_myapp_session', domain: ENV['SESSION_STORE_DOMAIN'], tld_length: ENV['TLD_LENGTH'].to_i
else
Rails.application.config.session_store :cookie_store, key: '_myapp_session', domain: :all, tld_length: 2
end
I also tried to experiment with the redis-session-store gem after encountering this error but this leads to a InvalidAuthenticityToken error.
I don't really want to change my session store to use redis though. Is there any way to solve this or am I missing something?
UPDATE 1
sessions_controller.rb (devise)
def destroy
signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))
set_flash_message! :notice, :signed_out if signed_out
yield if block_given?
respond_to_on_destroy
end
Upvotes: 0
Views: 1156
Reputation: 1434
In your sessions_controller.rb
add session.delete(:user_id)
to the destroy
method
def destroy
#...
session.delete(:user_id)
end
Upvotes: 1