Handle auth errors

Most error conditions will be handled if you implement browser authentication as the fallback process. If any errors occur with app authentication, Sonos sends the user to a Web page for browser implementation. The following describes how to handle other error conditions in getDeviceAuthToken responses.

Failure response to getDeviceAuthToken

During browser authentication, Sonos calls getDeviceAuthToken repeatedly, polling for the response until the call either succeeds or fails. A sample success response is shown in Add browser authentication. If for any reason your service is not able to provide a token, send a failure response that includes the following:

  • faultcode — The value should be Client.NOT_LINKED_FAILURE.
  • faultstring — A message indicating that getting the token failed.The message in this string is placed in the Sonos logs.
  • ExceptionInfo — A message indicating the response the Sonos app should take. This message string is placed in the Sonos logs.
  • SonosError — This value must be 6 in order for the Sonos app to respond correctly. Your string tables require a corresponding custom error message with this value and an associated error message string. However, the content of the message string is not displayed or stored on Sonos anywhere.

For example:

. . .
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.sonos.com/Services/1.1">
         <faultstring>Access to token failed</faultstring>
            <ns:ExceptionInfo>Restart authentication.</ns:ExceptionInfo>

If your service does not finally respond to getDeviceAuthToken with either success or failure within seven minutes, Sonos will automatically treat getDeviceAuthToken as a failed call.

See Error handling for general error handling.