Skip to content

Commit

Permalink
fix: add missing headers
Browse files Browse the repository at this point in the history
  • Loading branch information
pwall2222 committed Apr 17, 2024
1 parent e28acb2 commit dba09a6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions NOWT/Helpers/Checks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ public static async Task<bool> CheckLoginAsync()
return false;
var client = new RestClient(
$"https://pd.{Constants.Region}.a.pvp.net/account-xp/v1/players/{Constants.Ppuuid}"
);
);

var request = new RestRequest()
.AddHeader("Authorization", $"Bearer {Constants.AccessToken}")
.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken);
.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken)
.AddHeader("X-Riot-ClientPlatform", Constants.Platform)
.AddHeader("X-Riot-ClientVersion", Constants.Version);
var response = await client.ExecuteGetAsync(request).ConfigureAwait(false);
if (response.IsSuccessful)
return true;
Expand Down Expand Up @@ -68,6 +70,8 @@ public static async Task<bool> CheckMatchAsync()
var request = new RestRequest();
request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken);
request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}");
request.AddHeader("X-Riot-ClientPlatform", Constants.Platform);
request.AddHeader("X-Riot-ClientVersion", Constants.Version);
var response = await client.ExecuteGetAsync(request).ConfigureAwait(false);
if (response.IsSuccessful)
return true;
Expand Down
9 changes: 9 additions & 0 deletions NOWT/Helpers/LiveMatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ private static async Task<bool> CheckAndSetLiveMatchIdAsync()
var request = new RestRequest();
request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken);
request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}");
request.AddHeader("X-Riot-ClientPlatform", Constants.Platform);
request.AddHeader("X-Riot-ClientVersion", Constants.Version);
var response = await client.ExecuteGetAsync<MatchIDResponse>(request).ConfigureAwait(false);
if (response.IsSuccessful)
{
Expand Down Expand Up @@ -69,6 +71,7 @@ public async Task<bool> CheckAndSetPartyIdAsync()
var request = new RestRequest();
request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken);
request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}");
request.AddHeader("X-Riot-ClientPlatform", Constants.Platform);
request.AddHeader("X-Riot-ClientVersion", Constants.Version);
var response = await client.ExecuteGetAsync<PartyIdResponse>(request).ConfigureAwait(false);
if (!response.IsSuccessful)
Expand Down Expand Up @@ -103,6 +106,8 @@ private static async Task<LiveMatchResponse> GetLiveMatchDetailsAsync()
RestRequest request = new();
request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken);
request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}");
request.AddHeader("X-Riot-ClientPlatform", Constants.Platform);
request.AddHeader("X-Riot-ClientVersion", Constants.Version);
var response = await client
.ExecuteGetAsync<LiveMatchResponse>(request)
.ConfigureAwait(false);
Expand All @@ -124,6 +129,8 @@ private static async Task<PreMatchResponse> GetPreMatchDetailsAsync()
RestRequest request = new();
request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken);
request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}");
request.AddHeader("X-Riot-ClientPlatform", Constants.Platform);
request.AddHeader("X-Riot-ClientVersion", Constants.Version);
var response = await client
.ExecuteGetAsync<PreMatchResponse>(request)
.ConfigureAwait(false);
Expand All @@ -145,6 +152,8 @@ private static async Task<PartyResponse> GetPartyDetailsAsync()
RestRequest request = new();
request.AddHeader("X-Riot-Entitlements-JWT", Constants.EntitlementToken);
request.AddHeader("Authorization", $"Bearer {Constants.AccessToken}");
request.AddHeader("X-Riot-ClientPlatform", Constants.Platform);
request.AddHeader("X-Riot-ClientVersion", Constants.Version);
var response = await client.ExecuteGetAsync<PartyResponse>(request).ConfigureAwait(false);
if (response.IsSuccessful)
return response.Data;
Expand Down

0 comments on commit dba09a6

Please sign in to comment.