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?