Welcome Guest, Not a member yet? Register   Sign In
Login to client account programatically
#1

Hi,

I have an app which has a master account/database running on "example.com", with client accounts/databases using subdomains, e.g. "test.example.com".

I am trying to add a function in the master account to programatically login as the admin user of the client account. I can connect to the client DB, get the admin user, and set the session as I normally would for a normal login, but the problem I'm having is the session cookie is being set on example.com rather than test.example.com, causing the login to fail.

I can't set the cookie domain to be ".example.com" (site-wide) as each client account must have separate logins/sessions.

The simplest solution I could think of was would be to change the cookie domain before setting the session, so this one off time it would use my specified domain instead, i.e.:

PHP Code:
$this->config->set_item('cookie_domain''test.example.com'); 

This however doesn't seem to update the cached config item in the Session library.

My question is, is there any way to update this value dynamically in this way? If not, is there an alternate solution to my problem?

Any ideas are appreciated, and I can answer any additional questions about my app if you need.

Thanks,
Jay.
Reply


Messages In This Thread
Login to client account programatically - by JayAdra - 02-22-2017, 10:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB