Changed to add listener only after successful login to avoid reconnect tries on credential errors