Skip to main content

I’m trying to automate Spotify playing music on my Sonos speakers when I scan a NFC tag.

I thought I could use Tasker to automate the necessary API calls...

However, Sonos only supports the OAuth flow “Authorization code”, which makes it impossible to automate the task, since I have to show a webpage to the user for that to work.

Is it possible to authenticate in any non-interactive way (Client credentials) or can I automate the Sonos app somehow? (e.g. Android intent?)

Sure, AVTransport.SetAVTransportURI is the call you need to make on the Coordinator. The hard part is figuring out the resource and the metadata to get it to work - sniff a call from the controller with Netmon. Buried in those args is the id of the item to play, wrapped in a url that is cracked on the speaker into the required SMAPI calls and the music service endpoint.

At this level you don’t need to auth anything - the players contain the tokens, and this API just requires args.