From 858aca59fb10ca70f24dd281157b2921a721ab5a Mon Sep 17 00:00:00 2001 From: zotabee <89345101+zotabee@users.noreply.github.com> Date: Mon, 19 Oct 2026 23:39:55 +0200 Subject: [PATCH] Revoke the stored token without parsing the empty reply Co-Authored-By: Claude Opus 5.5 --- Trakt/Api/TraktApi.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Trakt/Api/TraktApi.cs b/Trakt/Api/TraktApi.cs index 273b666..2eb41d3 100644 --- a/Trakt/Api/TraktApi.cs +++ b/Trakt/Api/TraktApi.cs @@ -970,14 +970,20 @@ public async Task DeauthorizeDevice(TraktUser traktUser) client_secret = TraktUris.ClientSecret }; + // Revoking on trakt.tv is best-effort; the caller removes the local user regardless. + // trakt.tv answers with an empty body, and the token to revoke is the stored one, so this + // doesn't go through PostToTrakt, which parses the body and may refresh the token first. try { - await PostToTrakt(TraktUris.RevokeToken, deviceRevokeRequest, traktUser).ConfigureAwait(false); + using var response = await PostToTrakt(TraktUris.RevokeToken, deviceRevokeRequest).ConfigureAwait(false); + if (!response.IsSuccessStatusCode) + { + _logger.LogWarning("Couldn't revoke the access token on trakt.tv: {StatusCode}", (int)response.StatusCode); + } } - catch (Exception) + catch (Exception ex) { - // Revoking on trakt.tv is best-effort; the caller removes the local user - // regardless, and PostToTrakt already logged the underlying failure. + _logger.LogWarning(ex, "Couldn't revoke the access token on trakt.tv"); } }