Skip to main content

I am the author of the SpotifyPlus integration used in the Home Assistant home automation software.  I am trying to figure out how to specify the call parameters for a Sonos device to the Spotify Connect ZeroConf “addUser” endpoint, which is called to login to Spotify Connect for the specified device.  I am currently using a Sonos IKEA Symfonisk (gen 2) device to test with, as well as a Spotify Premium account.

A Spotify Connect Zeroconf login needs to be done programmatically so that the Sonos device can be accessed by Spotify Connect after a period of inactivity.  The Sonos device automatically logs out of Spotify Connect after the inactivity period, and needs to be re-awakened (e.g. login again) in order to be selected.

In working with other vendors that support Spotify Connect (Bose, Onkyo, Yamaha, etc), they use a “tokenType=accesstoken” in the addUser parameters.  The “blob” parameter is formatted with a Spotify user-id and password value, and the addUser call successfully logs the user in to Spotify Connect for the device.  No problems with “tokenType=accesstoken” devices.

It appears that Sonos devices use a “tokenType=authorization_code” value in its addUser parameters.  The “blob” parameter is different for this token type than for a “accesstoken” token type.

What I would like to know is what to specify in the addUser parameters, namely the “blob” and the “loginId” parameters, for the “authorization_code” token type.  Based upon Wireshark traces when the Spotify desktop application is used ... 

  • “blob” - appears to be a serialized token value.
  • “loginId” - appears to be an SHA1 representation of a loginId value.

Spotify Connect addUser call to a Sonos device example:

&userName=31l77y ...redacted
&blob=AQC4E8xSTYmGAo2UK1dC6n4 ...redacted
&clientKey=
&tokenType=authorization_code
&loginId=f2860abad3313 ...redacted
&deviceName=THLUC ...redacted
&deviceId=80da4987232 ...redacted
&version=2.7.1

Thoughts? 

Anybody else running into this?

Any thoughts, hints, or documentation from a Sonos technical person?

Any help would be appreciated.

Thanks - Todd

Hi @thlucas 

Welcome to the Sonos Community! And, apologies for the delay.

Honestly, I wouldn’t know where to start with that, but if our developer pages are of no help (I suspect not, as they are largely related to our own API), then it may be better to ask Spotify directly - although Spotify Connect works with Sonos, it is their “baby”, so to speak.

I hope this helps.


Thanks Cory - I figured as much, but thought it would be worth a shot to get the Sonos perspective.  I have reached out to them as well, but have not received a response.

Thanks for getting back to me.