added cookie authentication for persisting sessions