Skip to content

Commit

Permalink
Fix wrong clientId in getting auth pin.
Browse files Browse the repository at this point in the history
  • Loading branch information
bakes82 committed Nov 29, 2020
1 parent 72eeca9 commit 99c8b2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions TraktLists/Api/TraktApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ public async Task RefreshUserAuth(TraktUser traktUser, CancellationToken cancell
{
_logger.Error("Tried to reauthenticate with Trakt, but neither PIN nor refreshToken was available");
}

_logger.Info($"{data.code} - {data.grant_type}");
TraktUserToken userToken;
using (var response = await PostToTrakt(TraktUris.Token, data, null, cancellationToken).ConfigureAwait(false))
{
_logger.Info($"{response}");
userToken = await _jsonSerializer.DeserializeFromStreamAsync<TraktUserToken>(response).ConfigureAwait(false);
}

Expand Down Expand Up @@ -98,15 +99,11 @@ private Task<Stream> PostToTrakt(string url, object data, TraktUser traktUser, C
return PostToTrakt(url, data, cancellationToken, traktUser);
}

/// <summary>
/// Posts data to url, authenticating with <see cref="TraktUser"/>.
/// </summary>
/// <param name="traktUser">If null, authentication headers not added.</param>
private async Task<Stream> PostToTrakt(string url, object data, CancellationToken cancellationToken,
TraktUser traktUser)
{
var requestContent = data == null ? string.Empty : _jsonSerializer.SerializeToString(data);
if (traktUser != null && traktUser.ExtraLogging) _logger.Debug("POST " + requestContent);
_logger.Info("POST " + requestContent);
var options = GetHttpRequestOptions();
options.Url = url;
options.CancellationToken = cancellationToken;
Expand Down
2 changes: 1 addition & 1 deletion TraktLists/Config/configPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h1>Channel Setup</h1>
<div class="inputContainer">
<input is="emby-input" id="txtPin" name="txtPin" type="text" label="Trakt Authentication PIN:" />
<div class="fieldDescription">
<a href="https://trakt.tv/oauth/authorize?response_type=code&client_id=c44548028dcd8f31e9bee55318562e6e5deb8524f5ca3e77e167fd3b1c9ce380&redirect_uri=urn:ietf:wg:oauth:2.0:oob" target="_blank">Get PIN.</a> When the PIN is successfully exchanged for a token, it is deleted from this field. Afterwards, the hidden token is used.
<a href="https://trakt.tv/oauth/authorize?response_type=code&client_id=780354638b11da9a2e93e0c4498d6a1a0e8428a6da3cca70c98c19c8f0caeb52&redirect_uri=urn:ietf:wg:oauth:2.0:oob" target="_blank">Get PIN.</a> When the PIN is successfully exchanged for a token, it is deleted from this field. Afterwards, the hidden token is used.
</div>
</div>
<h2>Custom Trakt Lists</h2>
Expand Down

0 comments on commit 99c8b2f

Please sign in to comment.