From 7cba915c5eb3bfa0f711f5b8e29971ec2634d3ee Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Wed, 4 Feb 2026 23:44:45 -0500 Subject: [PATCH] Fix authentication issues in SpotifyTrackMatchingService - Fixed SpotifyTrackMatchingService to use GetJsonAsyncInternal for authenticated requests - This resolves 401 Unauthorized errors when fetching existing playlist tracks - Should prevent unnecessary rematching when cache is warm - Fixes 'No Items found in Jellyfin playlist response' warnings The service was using GetJsonAsync with null headers, causing 401 errors. Now uses server API key authentication for internal operations. --- allstarr/Services/Spotify/SpotifyTrackMatchingService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs index 4828e92..700d682 100644 --- a/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs +++ b/allstarr/Services/Spotify/SpotifyTrackMatchingService.cs @@ -241,19 +241,19 @@ public class SpotifyTrackMatchingService : BackgroundService // CRITICAL: Must include UserId parameter or Jellyfin returns empty results var userId = jellyfinSettings.UserId; var playlistItemsUrl = $"Playlists/{playlistConfig.JellyfinId}/Items"; + var queryParams = new Dictionary(); if (!string.IsNullOrEmpty(userId)) { - playlistItemsUrl += $"?UserId={userId}"; + queryParams["UserId"] = userId; } else { _logger.LogWarning("No UserId configured - may not be able to fetch existing playlist tracks for {Playlist}", playlistName); } - var (existingTracksResponse, _) = await proxyService.GetJsonAsync( + var (existingTracksResponse, _) = await proxyService.GetJsonAsyncInternal( playlistItemsUrl, - null, - null); + queryParams); if (existingTracksResponse != null && existingTracksResponse.RootElement.TryGetProperty("Items", out var items))