Refreshed auth token not persisting - sonos

We seem to be encountering an issue where we are refreshing auth tokens via a fault as described in the "REFRESHING EXPIRED TOKENS USING A SOAP FAULT" section of the "Processing authentication tokens" page. Sonos is receiving the new token and using it to fulfill its original request, but is then reverting back to using the old token information.
We captured some traffic showing the problem and have been able to reproduce it several times.
First, Sonos makes a request using an expired token:
POST /soap HTTP/1.1
Connection: Keep-Alive
Content-Type: text/xml; charset="utf-8"
Accept-Encoding: gzip
Accept-Language: en-US
Host: <our_service>
Max-Forwards: 10
User-Agent: Linux UPnP/1.0 Sonos/52.13-69030 (ICRU_iPhone11,8)
X-Sonos-Controller-ID: 02A4****
X-Sonos-Api-Key: 4348****
X-Sonos-Corr-Id: c27c47ca-50c7-4a45-8c77-12c6b6a4415c
SOAPACTION: "http://www.sonos.com/Services/1.1#getMetadata"
X-FORWARDED-PROTO: https
X-FORWARDED-PORT: 443
X-ORIGINAL-HOST: <our_service>
X-Original-URL: /soap
X-Forwarded-For: ****
X-ARR-SSL: ****
X-ARR-LOG-ID: 203a446d-76ec-498d-b72d-ad8e61a0611e
Content-Length: 803
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<context xmlns="http://www.sonos.com/Services/1.1">
<timeZone>-4:00</timeZone>
</context>
<credentials xmlns="http://www.sonos.com/Services/1.1">
<loginToken>
<token>95ce****</token>
<key>{"Expires":"2019-09-24T18:33:58.7093084Z","RefreshToken":"ceaa****"}</key>
<householdId>Sonos_sIGui81Pzu6Jny5L0ELN0WnJsG</householdId>
</loginToken>
<deviceId>78-28-CA-03-DA-40:B</deviceId>
<deviceProvider>Sonos</deviceProvider>
</credentials>
</s:Header>
<s:Body>
<getMetadata xmlns="http://www.sonos.com/Services/1.1">
<id>root</id>
<index>0</index>
<count>100</count>
</getMetadata>
</s:Body>
</s:Envelope>
Our service recognizes the token as expired and refreshes it:
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset="utf-8"
Server: Microsoft-IIS/10.0
Date: Wed, 25 Sep 2019 13:45:39 GMT
Content-Length: 554
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>Client.TokenRefreshRequired</faultcode>
<faultstring>Auth Token Refreshed</faultstring>
<detail>
<refreshAuthTokenResult xmlns="http://www.sonos.com/Services/1.1">
<authToken>d464****</authToken>
<privateKey>{"Expires":"2019-09-25T14:45:39.2925349Z","RefreshToken":"a0ab****"}</privateKey>
</refreshAuthTokenResult>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Sonos receives the new token, and uses it to fulfill its original request:
POST /soap HTTP/1.1
Connection: Keep-Alive
Content-Type: text/xml; charset="utf-8"
Accept-Encoding: gzip
Accept-Language: en-US
Host: <our_service>
Max-Forwards: 10
User-Agent: Linux UPnP/1.0 Sonos/52.13-69030 (ICRU_iPhone11,8)
X-Sonos-Controller-ID: 02A4****
X-Sonos-Api-Key: 4348****
X-Sonos-Corr-Id: 6f050fc0-027a-410c-8315-bf22486140a7
SOAPACTION: "http://www.sonos.com/Services/1.1#getMetadata"
X-FORWARDED-PROTO: https
X-FORWARDED-PORT: 443
X-ORIGINAL-HOST: <our_service>
X-Original-URL: /soap
X-Forwarded-For: ****
X-ARR-SSL: ****
X-ARR-LOG-ID: 745f02ac-60c7-440f-9c0c-620b73905b39
Content-Length: 803
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<context xmlns="http://www.sonos.com/Services/1.1">
<timeZone>-4:00</timeZone>
</context>
<credentials xmlns="http://www.sonos.com/Services/1.1">
<loginToken>
<token>d464****</token>
<key>{"Expires":"2019-09-25T14:45:39.2925349Z","RefreshToken":"a0ab****"}</key>
<householdId>Sonos_sIGui81Pzu6Jny5L0ELN0WnJsG</householdId>
</loginToken>
<deviceId>78-28-CA-03-DA-40:B</deviceId>
<deviceProvider>Sonos</deviceProvider>
</credentials>
</s:Header>
<s:Body>
<getMetadata xmlns="http://www.sonos.com/Services/1.1">
<id>root</id>
<index>0</index>
<count>100</count>
</getMetadata>
</s:Body>
</s:Envelope>
The new token is good, so we respond with information:
HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
Server: Microsoft-IIS/10.0
Date: Wed, 25 Sep 2019 13:45:41 GMT
Content-Length: 4408
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<getMetadataResponse xmlns="http://www.sonos.com/Services/1.1">
<getMetadataResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<index>0</index>
<count>1</count>
<total>1</total>
<mediaCollection>
DATA
</mediaCollection>
</getMetadataResult>
</getMetadataResponse>
</s:Body>
</s:Envelope>
Everything is working as expected that far. But then when Sonos tries to make another request, it's reverting to using the old authentication information:
POST /soap HTTP/1.1
Connection: Keep-Alive
Content-Type: text/xml; charset="utf-8"
Accept-Encoding: gzip
Host: <our_service>
Max-Forwards: 10
User-Agent: Linux UPnP/1.0 Sonos/52.13-69030 (ZPS13)
X-Sonos-Corr-Id: 813f189e-8a70-41c2-8aaa-c1b117f6045d
SOAPACTION: "http://www.sonos.com/Services/1.1#getMetadata"
X-FORWARDED-PROTO: https
X-FORWARDED-PORT: 443
X-ORIGINAL-HOST: <our_service>
X-Original-URL: /soap
X-Forwarded-For: ****
X-ARR-SSL: ****
X-ARR-LOG-ID: 1158ddfa-df17-4f37-8843-1133566dacbe
Content-Length: 855
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<credentials xmlns="http://www.sonos.com/Services/1.1">
<deviceId>78-28-CA-03-DA-40:B</deviceId>
<deviceProvider>Sonos</deviceProvider>
<loginToken>
<token>95ce****</token>
<key>{"Expires":"2019-09-24T18:33:58.7093084Z","RefreshToken":"ceaa****"}</key>
<householdId>Sonos_sIGui81Pzu6Jny5L0ELN0WnJsG</householdId>
</loginToken>
</credentials>
<context xmlns="http://www.sonos.com/Services/1.1">
<timeZone>-4:00</timeZone>
</context>
</s:Header>
<s:Body>
<getMetadata xmlns="http://www.sonos.com/Services/1.1">
<id>audiobook:18789269:791128</id>
<index>0</index>
<count>2147483647</count>
<recursive>1</recursive>
</getMetadata>
</s:Body>
</s:Envelope>
That token is still expired, and that refresh token has now been used already and discarded, so we respond saying the user must re-authenticate:
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset="utf-8"
Server: Microsoft-IIS/10.0
Date: Wed, 25 Sep 2019 13:45:43 GMT
Content-Length: 213
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>Client.AuthTokenExpired</faultcode>
<faultstring>Error refreshing auth token</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
We're not sure what's going wrong, as Sonos appears to be recognizing our refresh response and uses the new information the first time. Is there something we need to do differently?

The first request comes from the Sonos app (indicated by ICRU_iPhone11,8 in the user-agent). Your service sends new credentials to the app and the app updates them and makes a request with them.
The next request is from a Sonos player in the household (ZPS13 in the user-agent). The Sonos player does not have the new authentication information as the Sonos app does not replicate new credentials to the players. In this case, you should handle multiple token refreshes using the same refresh token. Once the player receives new credentials, it propagates them to other players and apps.
If the first request had come from a Sonos player, the player would event out new credentials to other players and apps.
I'll update the Processing Authentication Tokens for API Requests documentation with this information.

Related

Sonos player grouping via local communication not working

I have used this but it throws 714 error code my code is as below:
POST /MediaRenderer/AVTransport/Control
Host: 172.16.3.39:1400
Content-Type: text/xml
soapaction: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI"
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
<InstanceID>0</InstanceID>
<CurrentURI>RINCON_48A6B8DBCC2A01400</CurrentURI>
<CurrentURIMetaData></CurrentURIMetaData>
</u:SetAVTransportURI>
</s:Body>
</s:Envelope>
But when I replace the rincon id with "x-rincon-queue:RINCON_48A6B8DBCC2A01400#0" then I get success 200 but players are not grouped, as it does using sonos global api.

Merge records and Restore Deleted records for Salesforce using HTTP or API call from Postman?

I am trying to see if I can make a Merge Record call or Restore Deleted Records using an API call (read REST or SOAP call). Tried researching around it but most examples need custom code written in Java or .NET.
I am trying to see if it can be done using HTTP Request itself without custom code. In worst case, Apex Web Services related calls can be written I suppose but I am trying to find a way using HTTP Request itself.
I have gone through API documentation but my doubt persists on how to implement. In Salesforce API I couldnt find a suitable call around this.
Thanks in advance.
SOAP API has the merge operation. Import the WSDL to your project. Call login first, get the serverUrl and sessionId, then:
Merge
Request
POST https://{redacted}.my.salesforce.com/services/Soap/u/52.0/{redacted} HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 882
Host: {redacted}
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/12.0.1)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com" xmlns:urn1="urn:sobject.partner.soap.sforce.com">
<soapenv:Header>
<urn:SessionHeader>
<urn:sessionId>00D{redacted}</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:merge>
<urn:request>
<urn:masterRecord>
<urn1:type>Lead</urn1:type>
<urn1:Id>00Q3O000003aFYtUAM</urn1:Id>
</urn:masterRecord>
<urn:recordToMergeIds>00Q3O000003aFYuUAM</urn:recordToMergeIds>
<urn:recordToMergeIds>00Q3O000003aFYyUAM</urn:recordToMergeIds>
</urn:request>
</urn:merge>
</soapenv:Body>
</soapenv:Envelope>
Response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com">
<soapenv:Header>
<LimitInfoHeader>
<limitInfo>
<current>65</current>
<limit>5000000</limit>
<type>API REQUESTS</type>
</limitInfo>
</LimitInfoHeader>
</soapenv:Header>
<soapenv:Body>
<mergeResponse>
<result>
<id>00Q3O000003aFYtUAM</id>
<mergedRecordIds>00Q3O000003aFYuUAM</mergedRecordIds>
<mergedRecordIds>00Q3O000003aFYyUAM</mergedRecordIds>
<success>true</success>
</result>
</mergeResponse>
</soapenv:Body>
</soapenv:Envelope>
Undelete is there too.
POST https://{redacted}.my.salesforce.com/services/Soap/u/52.0/{redacted} HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 568
Host: {redacted}
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/12.0.1)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com">
<soapenv:Header>
<urn:SessionHeader>
<urn:sessionId>00D{redacted}</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:undelete>
<urn:ids>a141q000001RfNeAAK</urn:ids>
<urn:ids>a141q000001RfOVAA0</urn:ids>
</urn:undelete>
</soapenv:Body>
</soapenv:Envelope>
Don't think REST API has matching operations.

Office.context.mailbox.getCallbackTokenAsync() empty token

I'm having a problem with a web add-in for Outlook.
The Outlook client is 2016 (MSI) which I believe means that it supports no higher than JavaScript API 1.4, opposed to Outlook 2016 (C2R) which, as I recall it, supports JavaScript API 1.6 or maybe even higher.
Anyway, I'm trying to use the method Office.context.mailbox.getCallbackTokenAsync(asyncResult) which has previously worked just fine on the server where it is used, but now it has stopped working for some odd reason.
The asyncResult is now empty or rather the token is empty.
{"value":"","status":"succeeded"}
How can the token be empty all of the sudden when this add-in used to work perfectly?
According to the admin of the server, it has received Windows updates on the date that this stopped working for both Office and Outlook specifically.
The Outlook clients connect to an Exchange 2013 (CU7 December 9, 2014 : 15.0.1044.25) which has also received some updates.
Both servers have been rebooted since then, but nothing has changed. The token remains empty.
Can anyone shed some light on what could be the cause of this if anyone knows that is, because all I can really do myself at this point is guess?
UPDATE 1
I have now been given permission to install Fiddler and I have found the request and respond regarding the attempt to retrieve the token.
Can any of you who know the Exchange server inside out see what is going on here, because I don't see any reasoning as to what is failing, except that the response message indicates that the request is faulty somehow (which hasn't been changed for more then a year at least).
Here is the request (some names have been replaced with something generic).
REQUEST
POST https://<domain>/ews/Exchange.asmx HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Type: text/xml; charset=utf-8
User-Agent: Microsoft Office/16.0 (Windows NT 6.3; Microsoft Outlook 16.0.4849; Pro)
X-User-Identity: <account>#<domain>.com
Depth: 0
Content-Length: 801
Host: <host>
Authorization: Negotiate TlRMTVNTUAADAAAAGAAYAJ4AAABCAUIBtgAAAAAAAABYAAAANAA0AFgAAAASABIAjAAAABAAEAD4AQAAFYKI4gYDgCUAAAAPGSbYTqZVeCx7cnQxM336pnMAeQBzAHQAZQBtAGMAbwBuAG4AZQBjAHQAQABlAHMAdABpAGMAaABlAG0ALgBjAG8AbQBFAFMAVABJAC0AQwBUAFgAMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT6dTWGCCv/rRor0Srrxd9AQEAAAAAAADJcWWYQo7VATtznMo8smALAAAAAAIACABFAFMAVABJAAEAFABFAFMAVABJAC0ARQBYAEMASAAxAAQAFABFAFMAVABJAC4AbABvAGMAYQBsAAMAKgBFAFMAVABJAC0ARQBYAEMASAAxAC4ARQBTAFQASQAuAGwAbwBjAGEAbAAFABQARQBTAFQASQAuAGwAbwBjAGEAbAAHAAgAyXFlmEKO1QEGAAQAAgAAAAgAMAAwAAAAAAAAAAAAAAAAIAAA77CK35CNnSd54Hy6NnToh6W3Oxa6tsihxlCrQ8jwDWMKABAARs+Rq8MKQZq+cmQJ8nL9/gkALABIAFQAVABQAC8AbQBhAGkAbAAuAGUAcwB0AGkAYwBoAGUAbQAuAGMAbwBtAAAAAAAAAAAAeHckPR2HOLOW0y2ri7TR1A==
Cookie: OutlookSession="{994C5944-A93C-4830-9E6F-605881790815}"; ClientId=PRHSVIWKYUDISQLQPQ
<?xml version="1.0"?>
<q:Envelope
xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:q="http://schemas.xmlsoap.org/soap/envelope/">
<q:Header>
<ex12t:RequestServerVersion Version="Exchange2012"></ex12t:RequestServerVersion>
</q:Header>
<q:Body>
<ex12m:GetClientAccessToken>
<ex12m:TokenRequests>
<ex12t:TokenRequest>
<ex12t:Id>214c1212-e3ff-45eb-9218-2deb35d6b8b9</ex12t:Id>
<ex12t:TokenType>ScopedToken</ex12t:TokenType>
<ex12t:Scope>ParentItemId:AAMkADRiMzkyMjhmLWQ1NGItNDY0Mi04Nzk0LWYyNzMzZWQ2ZGE5MABGAAAAAAApHj7qoKF1QY4+pcwfu7uCBwCHPrayw2+bT5ByF4j5Y8QZAAAAAAEMAACHPrayw2+bT5ByF4j5Y8QZAAAAAAFxAAA=</ex12t:Scope>
</ex12t:TokenRequest>
</ex12m:TokenRequests>
</ex12m:GetClientAccessToken>
</q:Body>
</q:Envelope>
RESPONSE (some names have been replaced with something generic).
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/8.5
request-id: 1a7cbf79-8ba3-4a73-bfa2-1733d841b2b1
X-CalculatedBETarget: <server>.local
X-DiagInfo: <server>
X-BEServer: <server>
X-AspNet-Version: 4.0.30319
Set-Cookie: exchangecookie=2cd797c5290345a7861dfe60e16ecc12; expires=Thu, 29-Oct-2020 10:21:15 GMT; path=/; HttpOnly
Set-Cookie: X-BackEndCookie=S-1-5-21-2060358956-2462126529-2132206371-1263=u56Lnp2ejJqBmpzHns+cypzSncaZzdLLmprH0p3HxsvSm5yaycuazMieys/MgYHNz87G0s7O0s3Hq87Pxc3Oxc7K; expires=Thu, 28-Nov-2019 09:21:15 GMT; path=/ews; secure; HttpOnly
Persistent-Auth: true
X-Powered-By: ASP.NET
X-FEServer: <server>
Date: Tue, 29 Oct 2019 10:21:15 GMT
Content-Length: 1148
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="0" MajorBuildNumber="1044" MinorBuildNumber="21" Version="V2_22"
xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<m:GetClientAccessTokenResponse
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetClientAccessTokenResponseMessage ResponseClass="Error">
<m:MessageText>The token for this extension could not be retrieved.</m:MessageText>
<m:ResponseCode>ErrorInvalidClientAccessTokenRequest</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
</m:GetClientAccessTokenResponseMessage>
</m:ResponseMessages>
</m:GetClientAccessTokenResponse>
</s:Body>
</s:Envelope>

Sonos Music API getDeviceAuthToken retry responses not working

We've registered our service on the customsd page, and we're able to select it from the Add Music Services menu option. However, we're running into some difficulty during authorization.
When we start the sign in process, Sonos makes a getAppLink request to our service, we respond, and the button successfully takes the user to our sign-in page. That piece appears to be working.
However, we're running into issues with the getDeviceAuthToken polling that Sonos is doing. Once the sign-in process starts, Sonos consistently sends three getDeviceAuthToken requests and then gives up, sending no more requests even though we give back the necessary retry responses.
The requests from Sonos look like this (with some information partially or fully redacted and formatting added to the body for readability):
POST <our_soap_endpoint> HTTP/1.1
Connection: Keep-Alive
Content-Type: text/xml; charset="utf-8"
Accept-Encoding: gzip
Accept-Language: en-US
Host: <our_site>
Max-Forwards: 10
User-Agent: Linux UPnP/1.0 Sonos/51.1-67300 (ICRU_iPhone11,8)
X-Sonos-Controller-ID: 02A4****
X-Sonos-Api-Key: 4348****
X-Sonos-Corr-Id: 0b99****
SOAPACTION: "http://www.sonos.com/Services/1.1#getDeviceAuthToken"
X-FORWARDED-PROTO: https
X-FORWARDED-PORT: 443
X-ORIGINAL-HOST: <our_site>
X-Original-URL: <our_soap_endpoint>
X-Forwarded-For: <some_ip_address>
X-ARR-SSL: 2048|256|C=US, O=DigiCert Inc, CN=DigiCert SHA2 Secure Server CA|C=US, S=Ohio, L=Cleveland, O="OverDrive, Inc.", OU=OverDrive IT, CN=*.overdrive.com
X-ARR-LOG-ID: 5188****
Content-Length: 548
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<credentials xmlns="http://www.sonos.com/Services/1.1">
<deviceId>78****</deviceId>
<deviceProvider>Sonos</deviceProvider>
</credentials>
<context xmlns="http://www.sonos.com/Services/1.1">
<timeZone>-4:00</timeZone>
</context>
</s:Header>
<s:Body>
<getDeviceAuthToken xmlns="http://www.sonos.com/Services/1.1">
<householdId>Sonos_sIGu****</householdId>
<linkCode>ab76****</linkCode>
</getDeviceAuthToken>
</s:Body>
</s:Envelope>
Our responses look like this (again with some information partially or fully redacted and formatting added to the body for readability):
HTTP/1.1 500 Internal Server Error
Transfer-Encoding: chunked
Content-Type: text/xml; charset="utf-8"
Server: Microsoft-IIS/10.0
Date: Fri, 30 Aug 2019 13:25:25 GMT
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>Client.NOT_LINKED_RETRY</faultcode>
<faultstring>No token found for link code ab76****. Please retry.</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
From what we can tell based on the documentation for getDeviceAuthToken and error handling / faults, our responses appear to match what's expected for telling Sonos to try again. Are we missing something or doing something incorrectly?
Your response does not look correct. It should be something like this:
. . .
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.sonos.com/Services/1.1">
<soap:Body>
<soap:Fault>
<faultcode>Client.NOT_LINKED_FAILURE</faultcode>
<faultstring>Access to token failed</faultstring>
<detail>
<ns:ExceptionInfo>Restart authentication.</ns:ExceptionInfo>
<ns:SonosError>6</ns:SonosError>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
See HANDLING ERRORS DURING AUTHENTICATION for details.

Soap web servive access in iphone iOS

I need help for access web service in iOS (for below web service code). i try to implement soap web service to access web service but it returns false result. I give username and password directly and try to access, but its required base64 encrypted string for access this service (for example user name will be give in type of encrypted like NSString *Username=#"username:password"; ). This Username can convert to base64 encryption and then to access the web service.
I don't know how set header for AuthHeader and credentials tags for accessing below web service. so any one help me how to immplement bellow web service on iPhone.
SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /Test_Express/Service.asmx HTTP/1.1
Host: external.test.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/LoginValidation"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<AuthHeader xmlns="http://tempuri.org/">
<credentials>string</credentials>
</AuthHeader>
</soap:Header>
<soap:Body>
<LoginValidation xmlns="http://tempuri.org/">
<username>string</username>
<password>string</password>
</LoginValidation>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<LoginValidationResponse xmlns="http://tempuri.org/">
<LoginValidationResult>string</LoginValidationResult>
</LoginValidationResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.
POST /Test_Express/Service.asmx HTTP/1.1
Host: external.test.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<AuthHeader xmlns="http://tempuri.org/">
<credentials>string</credentials>
</AuthHeader>
</soap12:Header>
<soap12:Body>
<LoginValidation xmlns="http://tempuri.org/">
<username>string</username>
<password>string</password>
</LoginValidation>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<LoginValidationResponse xmlns="http://tempuri.org/">
<LoginValidationResult>string</LoginValidationResult>
</LoginValidationResponse>
</soap12:Body>
</soap12:Envelope>
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /Test_Express/Service.asmx/LoginValidation?username=string&password=string HTTP/1.1
Host: external.test.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">string</string>
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /Test_Express/Service.asmx/LoginValidation HTTP/1.1
Host: external.test.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
username=string&password=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">string</string>
I would suggest you start by going here: SOAP iOS generator this will allow you to communicate with your SOAP Web Service in a clean simple way.