TerribleDev / OwinOAuthProviders

OAuth providers for Owin
MIT License
504 stars 236 forks source link

Twitch deprecated API #241

Open Anton0123 opened 6 years ago

Anton0123 commented 6 years ago

The Twitch provider is currently using the old kraken V5 API which has been deprecated and replaced by the new helix API.

TerribleDev commented 6 years ago

Thanks @Anton0123 do you want to put in the work to update it?

Anton0123 commented 6 years ago

I think all that needs to be done is to change the TwitchAuthenticationOptions to:

private const string AuthorizationEndPoint = "https://id.twitch.tv/oauth2/authorize";
private const string TokenEndpoint = "https://id.twitch.tv/oauth2/token";
private const string UserInfoEndpoint = "https://api.twitch.tv/helix/users";

And on line 90 in TwitchAuthenticationHandler.cs to get the user: var userRequest = new HttpRequestMessage(HttpMethod.Get, Options.Endpoints.UserInfoEndpoint); userRequest.Headers.Add("Authorization", Uri.EscapeDataString("OAuth " + accessToken)); I haven't tested this and I'm a bit unsure if the headers are right