Sonos sends refreshAuthToken
to renew a token when an HTTP REST request returns a 401 error. See Use authentication tokens for details.
Request parameters
None
Response
Name | Type | Description |
---|---|---|
authToken |
string | The authorization token for the household. |
privateKey |
string | Additional information associated with a specific authorization token that allows the token to be refreshed. |
userInfo |
complex | (Optional, but recommended) Use this object to return the user’s nickname on your service. The Sonos app will pre-populate this nickname for the account holder when they add your service to their Sonos household. See SMAPI object types for details. |
Sample request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://www.sonos.com/Services/1.1"> <s:Header> <credentials> <loginToken> <token>12345678</token> <key>123456789</key> <householdId>Sonos_1234EJUN334GGPBMoESCwBABCD</householdId> </loginToken> <deviceId>B8-E9-37-BD-19-E2:2</deviceId> <deviceProvider>Sonos</deviceProvider> </credentials> </s:Header> <s:Body> <refreshAuthToken xmlns="http://www.sonos.com/Services/1.1"/> </s:Body> </s:Envelope> |
Sample valid response
1 2 3 4 5 6 7 8 9 10 |
<s:Envelope xmlns:ns="http://www.sonos.com/Services/1.1" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <ns:refreshAuthTokenResponse> <ns:refreshAuthTokenResult> <ns:authToken>1509120972472_3</ns:authToken> <ns:privateKey>376328174618</ns:privateKey> </ns:refreshAuthTokenResult> </ns:refreshAuthTokenResponse> </s:Body> </s:Envelope> |
Sample valid response with userInfo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<s:Envelope xmlns:ns="http://www.sonos.com/Services/1.1" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <ns:refreshAuthTokenResponse> <ns:refreshAuthTokenResult> <ns:authToken>1509120972472_3</ns:authToken> <ns:privateKey>633728174618</ns:privateKey> <userInfo> <userIdHashCode>911a30baf1d8ced73d016a07650787e7</userIdHashCode> <nickname>John Smith</nickname> </userInfo> </ns:refreshAuthTokenResult> </ns:refreshAuthTokenResponse> </s:Body> </s:Envelope> |