core icon indicating copy to clipboard operation
core copied to clipboard

Tidal: sign in from the admin UI instead of pasting an access token

Open rudyberends opened this issue 3 weeks ago • 1 comments

Moved from discussion #414, opened by @SirGustaw.

Problem

The Tidal provider only takes a raw access token plus a country code, entered by hand in the admin UI. sonn sends that token as Bearer to api.tidal.com/v1, for the catalog and for playback (/tracks/{id}/playbackinfopostpaywall). There is no login, no token exchange and no refresh.

In practice that means:

  • A token from an ordinary Tidal developer app does not get you there. Its client is registered as a web app, so the device flow is refused with Client is not a Limited Input Device client (see the discussion), and a token issued for the official openapi.tidal.com API is not what the v1 playback endpoint expects.
  • Even a working token stops working when it expires, and nothing tells the user.

So for most users Tidal in sonn cannot be set up today.

How Music Assistant does it

MA's Tidal provider signs in with the OAuth device flow at auth.tidal.com/v1/oauth2:

  1. device_authorization with a client id and scope r_usr w_usr w_sub.
  2. The user opens link.tidal.com with the code filled in and approves.
  3. MA polls /token, then reads the user id and country from /v1/sessions.
  4. Tokens are refreshed before they expire, and once after a 401.

Playback uses the same v1 playbackinfopostpaywall endpoint sonn already calls, plus DASH manifests for hi-res.

The blocker is the client. MA uses a device-capable client registered to the MA project and ships its credentials in a private build bundle. Those credentials are licensed for MA's official builds only, so sonn cannot reuse them.

Plan

  • Ask Tidal for a device-capable client for the sonn project.
  • With such a client: build the device-flow login in the admin UI (show the code and link, poll, store the refresh token), refresh tokens automatically, and take the country from the session instead of asking for it.
  • Until then: say clearly in the admin UI that a token from an official Tidal client is required, and point to the Music Assistant bridge as the working route for Tidal.

Workaround

Run Music Assistant, sign in to Tidal there, and use it in sonn through the Music Assistant bridge.

rudyberends avatar Nov 11 '26 18:11 rudyberends

Tidal is now fully built into sonn. It's in the dev build and will be in the next beta.

Signing in You add a Tidal account in the admin UI and sign in with a code on link.tidal.com, the same way you'd link a TV. You no longer need a token or a developer app of your own: the image ships with a Tidal client. sonn refreshes the session by itself, and reads your country and account details from Tidal.

Playback Tracks play through Tidal directly. Tidal decides per client what quality it delivers, and with the client in the image that is AAC 320 (Tidal's HIGH), not lossless. The admin UI shows what Tidal actually delivers.

Browsing

  • Your collection (tracks, albums, artists, playlists), your own playlists, and your mixes.
  • Tidal's own pages: Home, For You, New Music, Top Music and Hi-Res.
  • An artist opens like an artist page: top tracks, albums, singles and EPs, then similar artists and the artist radio. Albums and tracks lead on to similar albums, similar tracks and a track radio.
  • In the Loxone app, the Tidal account shows your mixes at the top, with New Music and Top Music below them, and your collection under Your Library. The app only knows Spotify, so the account appears there with the Spotify logo. The Podcasts tile stays empty, because Tidal has no podcasts.

Search works across tracks, albums, artists and playlists.

You no longer need to go through Music Assistant for Tidal. Feedback is welcome, especially on what the Loxone app shows.

rudyberends avatar Nov 15 '26 14:11 rudyberends