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?