I have subdomain login setup property such that username/password logs in on the domain
test.foobar.com.
I am trying to allow login from just
foobar.com that will redirect to the subdomain and be logged in, so I have added a subdomain field to the login form on
foobar.com/login.
I have overridden the SessionsController and am able to find the subdomain properly from this param, then am able to login the user correctly:
if subdomain_account
self.resource = warden.authenticate!(auth_options)
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => root_url(:subdomain => subdomain_account.subdomain)
else
render :global_new
end
The user appears to be logged in and there are no exceptions thrown, but on the respond_with redirect to
test.foobar.com, the login appears to be lost, that is, it is not reading from the cookie properly.
I have my session store :domain value set to :domain => '.
foobar.com', but devise is not recognizing that
foobar.com has already logged in the user. What am I doing wrong here?