Skip to content

Commit 3789cfb

Browse files
kinosangkevinchalet
authored andcommitted
Update the Twitch provider to use the new API
1 parent ce9cb27 commit 3789cfb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ public static class TwitchAuthenticationDefaults
3636
/// <summary>
3737
/// Default value for <see cref="OAuthOptions.AuthorizationEndpoint"/>.
3838
/// </summary>
39-
public const string AuthorizationEndPoint = "https://api.twitch.tv/kraken/oauth2/authorize";
39+
public const string AuthorizationEndPoint = "https://id.twitch.tv/oauth2/authorize";
4040

4141
/// <summary>
4242
/// Default value for <see cref="OAuthOptions.TokenEndpoint"/>.
4343
/// </summary>
44-
public const string TokenEndpoint = "https://api.twitch.tv/kraken/oauth2/token";
44+
public const string TokenEndpoint = "https://id.twitch.tv/oauth2/token";
4545

4646
/// <summary>
4747
/// Default value for <see cref="OAuthOptions.UserInformationEndpoint"/>.
4848
/// </summary>
49-
public const string UserInformationEndpoint = "https://api.twitch.tv/kraken/user/";
49+
public const string UserInformationEndpoint = "https://api.twitch.tv/helix/user/";
5050
}
5151
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected override async Task<AuthenticationTicket> CreateTicketAsync([NotNull]
3030
{
3131
var request = new HttpRequestMessage(HttpMethod.Get, Options.UserInformationEndpoint);
3232
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
33-
request.Headers.Authorization = new AuthenticationHeaderValue("OAuth", tokens.AccessToken);
33+
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", tokens.AccessToken);
3434

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

0 commit comments

Comments
 (0)