• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter Session Sharing between two apps

#1
[eluser]fountainhead[/eluser]
Hello All,

I have two apps:

myapp.com & m.myapp.com

I setup virtual hosts to serve them from different folders. Both are reference to the same database. I am using ion_auth.

Now my config files for both apps that I want to share the session is:

Code:
$config['sess_cookie_name']  = 'myapp';
$config['sess_expiration']  = 0;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name']  = 'default_ci_sessions';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

When I do some quick tests it looks like both of the apps are using EXACTLY the same session (I have the profiler enabled)

I am using the same chrome browser to log into the first app. The second app has no login and I simply want to use the session that was made from the first app after the user logged in.


It works fine and exactly like expected for the first few minutes. After few mins, I am trying to test by randomly logging in and logging out and accessing app2 to see the session info.

Suddenly, it looks like both the apps have different session ids.

Any thoughts on what I am missing? How do I make both apps to use the same exact session id?

Thank you.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.