This repository was archived by the owner on Mar 16, 2025. It is now read-only.
User-Agent #678
Closed
KoalaBear84
started this conversation in
Ideas
User-Agent
#678
Replies: 1 comment
-
|
No need to copy the whole file. public class MyTraktHttpClientProvider : HttpClientProvider
{
protected override void SetDefaultRequestHeaders(HttpClient httpClient)
{
base.SetDefaultRequestHeaders(httpClient);
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Here your user agent string");
}
}And using it like this: var traktClient = new TraktClient("TraktClientID", "TraktClientSecret", new MyTraktHttpClientProvider()); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Since yesterday ~ UTC 10:00, I got issues connecting to the API. When you do the request with the authorization code
traktClient.Authentication.GetAuthorizationAsyncit fails with 403.The issue became clear that it could be because of the User-Agent, because Trakt is testing some better bot protection.
trakt/trakt-api#507
For future reference to others, add a copy of https://github.com/henrikfroehling/Trakt.NET/blob/d434e179df9de832f9ccf8985a723d5d25652c86/Source/Lib/Trakt.NET/Requests/Handler/HttpClientProvider.cs and add
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("Here your user agent string");and the creating of the client to something like:I couldn't find an better option in any of the documentation. Maybe it could be an extra parameter or a traktClient.Configuration thing.
Beta Was this translation helpful? Give feedback.
All reactions