refactor in dnsapiclient to allow retry when token is invalid