CodeIgniter Forums
Community Auth - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7)
+--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13)
+--- Thread: Community Auth (/showthread.php?tid=74917)



Community Auth - nyl2k8 - 11-25-2019

Hi All,

I'm using Community Auth within my CI project. When a user is on the website there's a session generated in the ci_sessions table. When they log in, a new session is generated preventing me from recovering their cart contents as it's stored against their previous session id. Is it normal behaviour to have a new session id after login? Should it not be persistent like the PHP session data?

Any help here would be greatly appreciated.

Thank you,
nyl2k8


RE: Community Auth - InsiteFX - 11-28-2019

I would not depend on the session for cart data, you would be better off saving the
session cart data to a database table for cart_contents.

Then when they login you can just read the cart_contents for that users id and update
your session to reflect the cart contents.


RE: Community Auth - skunkbad - 11-28-2019

It’s considered best practice to rotate the session Id when logging in. So it’s not that you have a new session, it’s that it has a new Id.


RE: Community Auth - ehabafia - 11-29-2019

You shuold store the card data with the user.id and not the session.id.

this way, once the user logged in again, you can grab the data from the cart table where user.id = x.

I hope that helps.