Skip to content

Commit da5ad35

Browse files
kinosangmartincostello
authored andcommitted
Add Client-ID header to Twitch Helix API requests (#420)
Resolves #419.
1 parent 87c3383 commit da5ad35

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/AspNet.Security.OAuth.Twitch/TwitchAuthenticationConstants.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,10 @@ public static class Claims
2020
public const string ProfileImageUrl = "urn:twitch:profileimageurl";
2121
public const string Type = "urn:twitch:type";
2222
}
23+
24+
public static class Headers
25+
{
26+
public const string ClientId = "Client-ID";
27+
}
2328
}
2429
}

src/AspNet.Security.OAuth.Twitch/TwitchAuthenticationHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync([NotNull]
4848
var request = new HttpRequestMessage(HttpMethod.Get, Options.UserInformationEndpoint);
4949
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
5050
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", tokens.AccessToken);
51+
request.Headers.Add(TwitchAuthenticationConstants.Headers.ClientId, Options.ClientId);
5152

5253
var response = await Backchannel.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, Context.RequestAborted);
5354
if (!response.IsSuccessStatusCode)

0 commit comments

Comments
 (0)