4
4
* for more information concerning the license and the contributors participating to this project.
5
5
*/
6
6
7
+ using System . Collections . Generic ;
7
8
using System . Net . Http ;
8
9
using System . Net . Http . Headers ;
9
10
using System . Security . Claims ;
13
14
using Microsoft . AspNetCore . Authentication ;
14
15
using Microsoft . AspNetCore . Authentication . OAuth ;
15
16
using Microsoft . AspNetCore . Http . Authentication ;
17
+ using Microsoft . AspNetCore . WebUtilities ;
16
18
using Microsoft . Extensions . Logging ;
17
19
using Newtonsoft . Json . Linq ;
18
20
using static AspNet . Security . OAuth . Twitch . TwitchAuthenticationConstants ;
@@ -26,6 +28,17 @@ public TwitchAuthenticationHandler([NotNull] HttpClient client)
26
28
{
27
29
}
28
30
31
+ protected override string BuildChallengeUrl ( AuthenticationProperties properties , string redirectUri )
32
+ => QueryHelpers . AddQueryString ( Options . AuthorizationEndpoint , new Dictionary < string , string >
33
+ {
34
+ [ "client_id" ] = Options . ClientId ,
35
+ [ "scope" ] = FormatScope ( ) ,
36
+ [ "response_type" ] = "code" ,
37
+ [ "redirect_uri" ] = redirectUri ,
38
+ [ "state" ] = Options . StateDataFormat . Protect ( properties ) ,
39
+ [ "force_verify" ] = Options . ForceVerify ? "true" : "false"
40
+ } ) ;
41
+
29
42
protected override async Task < AuthenticationTicket > CreateTicketAsync ( [ NotNull ] ClaimsIdentity identity ,
30
43
[ NotNull ] AuthenticationProperties properties , [ NotNull ] OAuthTokenResponse tokens )
31
44
{
0 commit comments