I'm adding products to the cart using an ajax call. Inside the ajax responder I have the initial code.
Mage::app(); Mage::getSingleton('core/session', ['name' => 'frontend']);
If a user is not logged in it adds the products to the cart with no problems, but if a user is logged in, the second line causes the user to log out. Leaving the store in a logged out state with the last product added to the cart. Do I need to do anything to preserve the users session?