Lossless Fix: use correct Tidal client credentials and HTTP Basic Auth - #24
Open
bencejuhaasz wants to merge 1 commit into
Open
Lossless Fix: use correct Tidal client credentials and HTTP Basic Auth#24bencejuhaasz wants to merge 1 commit into
bencejuhaasz wants to merge 1 commit into
Conversation
…sless FLAC streaming The app was playing AAC for all tracks, even those available in lossless FLAC on Tidal. Three root causes fixed: 1. **Wrong client credentials**: The built-in client_id/client_secret belonged to a client without lossless entitlement. Switched to the same credentials used by tiddl (github.com/oskvr37/tiddl), which are known to work for FLAC access. 2. **Form-field auth produces AAC-only tokens**: The OAuth2 /token endpoint was sending client_secret as a form body field instead of using HTTP Basic Auth. The Tidal API uses the authentication method to determine token privileges — form-field auth grants restricted AAC-only tokens, while Basic Auth grants full lossless access. 3. **Quality fallback order was wrong**: HI_RES_LOSSLESS was tried first, but it often returns DASH manifests with AAC codec (not FLAC). Since the request succeeded, LOSSLESS was never reached. Now LOSSLESS (raw FLAC via BTS) is tried first, followed by HI_RES_LOSSLESS only if its DASH codec is actually FLAC. Additional improvements: - BtsManifest model now captures codecs/mimeType fields - DASH parser finds and prefers FLAC AdaptationSets - Multi-segment FLAC handled via local M3U8 playlist - HLS playlists include EXT-X-CODECS for proper mpv detection - Removed x-tidal-client-version header (tiddl does not send it) - auth_generation migration flag forces re-auth on credential changes - RIPTIDE_QUALITY_DEBUG env var for diagnostic logging - PlaybackInfo model captures audioQuality/bitDepth/sampleRate Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The app was playing AAC for all tracks, even those available in lossless FLAC on Tidal. Three root causes fixed:
Wrong client credentials: The built-in client_id/client_secret belonged to a client without lossless entitlement. Switched to the same credentials used by tiddl (github.com/oskvr37/tiddl), which are known to work for FLAC access.
Form-field auth produces AAC-only tokens: The OAuth2 /token endpoint was sending client_secret as a form body field instead of using HTTP Basic Auth. The Tidal API uses the authentication method to determine token privileges — form-field auth grants restricted AAC-only tokens, while Basic Auth grants full lossless access.
Quality fallback order was wrong: HI_RES_LOSSLESS was tried first, but it often returns DASH manifests with AAC codec (not FLAC). Since the request succeeded, LOSSLESS was never reached. Now LOSSLESS (raw FLAC via BTS) is tried first, followed by HI_RES_LOSSLESS only if its DASH codec is actually FLAC.
Additional improvements: