Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Trakt/Api/TraktApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>, which parses the body and may refresh the token first.
try
{
await PostToTrakt<object>(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");
}
}

Expand Down