public async Task <DeviceAuthToken> GetDeviceAuthToken(string householdId, string linkCode)
        {
            var loIn = new object[2];

            loIn[0] = householdId;
            loIn[1] = linkCode;

            var action = new SoapAction
            {
                ArgNames           = new[] { "householdId", "linkCode" },
                Name               = "getDeviceAuthToken",
                ExpectedReplyCount = 2
            };
            string header = "<s:Header>" +
                            "<credentials xmlns=\"{0}\">" +
                            "<sessionId>{1}</sessionId>" +
                            "<deviceId>{2}</deviceId>" +
                            "<deviceProvider>Sonos</deviceProvider>" +
                            "</credentials>" +
                            "</s:Header>";

            header = string.Format(header, ServiceType, "", _deviceId);
            //var te = await GetMessageHeader();
            SoapActionResult result = await InvokeActionAsync(action, loIn, header, false);

            Exception ex = null;

            if (result.Error != null)
            {
                ex = result.Error.Exception;
            }

            var actionResult = new ActionResult(result.XElement, ex);

            if (actionResult.Exception != null)
            {
                return(null);
            }
            var deviceAuthToken = new DeviceAuthToken(actionResult.Result);

            _credentialsOk = null;
            _sonosMusicApi.SetDeviceAuthToken(MusicServiceContainer.Title, deviceAuthToken);
            return(deviceAuthToken);
        }
 public void SetDeviceAuthToken(string serviceName, DeviceAuthToken deviceAuthToken)
 {
     _storage.Save("accessToken_" + serviceName, deviceAuthToken.XElement);
 }