2

Spotify Connect supports onboarding a device (i.e. wifi speaker) into your account directly from your Spotify Application. This is done through a protocol called informally zeroconf. It has been reversed engineered and documented to some extend.

Sadly, all the documentation on the internet explains how to implement your own Spotify Connect device.

I'm searching for the other side: How can I onboard a Spotify Connect device into my account. I have an OAuth2 Token.

I already gathered some information

  • The Spotify Connect Device announces an HTTP endpoint via MDNS
  • On this http endpoint, you do a POST to the announced endpoint, providing action=addUser and various more parameters as form encoded payload:
#!/bin/bash
USERNAME="theomega86"
TOKEN="BQBfYx[REDACTED]kMqbtlg"
curl -v -X POST -d "action=addUser&userName=$USERNAME&tokenType=accesstoken&blob=$TOKEN&clientKey=&loginId=x&deviceName=x&deviceId=x&version=2.7.1" http://192.168.1.102:51368/0

I was able to retrieve the appropriate values by capturing the packages the Spotify client is sending to the Spotify connect device. The only interesting payload in this request is the blob parameter. While this is a good step forward, the provided blob runs out after one hour. Sadly this blob is not a normal OAUTH2 token (I tried providing that). Does anyone have an idea how to construct the blob payload, assuming that I have an oauth2 token ready?

Cœur
  • 37,241
  • 25
  • 195
  • 267
theomega
  • 31,591
  • 21
  • 89
  • 127
  • Any luck finding a solution? I need a similar solution for my home automation project – Adam Edwards Jun 18 '20 at 07:24
  • The "blob" payload is documented here too: https://github.com/librespot-org/librespot/blob/master/docs/authentication.md#zeroconf-based-authentication – Idcmp Jan 13 '21 at 07:01
  • 1
    it looks like the HutSpot project may have some clues: https://github.com/sailfish-spotify/hutspot/blob/master/src/connect/spconnect.cpp – simon Jun 17 '21 at 10:28

0 Answers0