publish function and authentication