0

I'm using a Single Sign-On process where I receive the information to create/update a user and need to redirect it to my app as a logged in user.

With all the authentication process being done, I am using sign_in(@user) and redirecting the user to their tenant/subdomain (I'm using the Apartment gem for that). Instantly, I get a valid current_user, but I lose it just after redirecting.

I've also tried another helper method from Devise: sign_in_and_redirect @user, event: :authentication. What I get is cannot redirect to nil!, although @user is real User object.

What I can I do to persist the user session?

  • Check this, seems like you need to share the same cookie between all the domains so the session is shared https://stackoverflow.com/questions/10402777/share-session-cookies-between-subdomains-in-rails – arieljuod Nov 06 '21 at 00:26

0 Answers0