refactored auth cookie creation and user data storage