I have 2 ruby rails apps, each has a devise gem for authentication, my goal is to implement simple SSO (single sign-out), using shared sessions.
one of them with public.admin.com
and the other with private.admin.com
I am using the following configurations :
session_store.rb
Rails.application.config.session_store :cookie_store, key: '_shared_admin_session', domain: '.admin.com', tld_length: 2
config/secrets.yml
I also use the same secret_key_base
value in both applications
devise.rb
config.stretches = 1
config.pepper = ''
application.rb
config.action_dispatch.cookies_serializer = :hybrid
I can sign in for one of them and the session is open once I open the other domain Completed 401 Unauthorized
is returned and the opend session is closed and sign out from the first domain.
I've tried with using domain: 'admin.com'
, domain: :all
,and ..session_store :redis_store..
, but the same result always.
can anyone please help me find the problem, or suggest a better solution, I will be thankful.
I found the problem, it was simple.
the problem was in use 2 different DBs, after unifying admin table things worked fine.