Added auth cookie functionality