Implement and use a generic auth. cookie initialization function.