Implements authentication endpoint