public async Task InvokeAsync(HttpContext context, ITwitchAuthorizing _twitchAuthorizing) { context.Request.Headers.TryGetValue("TwitchCode", out var twitchCode); _twitchAuthorizing.Authorize(twitchCode.ToString()); await _next(context); }
public Task <TwitchAuthorizeInfoDto> Handle(AuthorizeTwitchUserCommand request, CancellationToken cancellationToken) { _twitchAuthorizing.Authorize(request.Code); var user = _twitchUserApi.GetCurrentUser(); var authorizeInfoDto = new TwitchAuthorizeInfoDto() { Id = user.Id, DisplayName = user.DisplayName, AccessCode = request.Code, ProfileImageUrl = user.ProfileImageUrl }; return(Task.FromResult(authorizeInfoDto)); }