private async Task PrepareAuthenticatedClient()

in src/Relecloud.Web.CallCenter/Services/RelecloudApiServices/RelecloudApiConcertService.cs [227:237]


        private async Task PrepareAuthenticatedClient()
        {
            var identity = this.httpContextAccessor.HttpContext?.User?.Identity;
            if (identity != null && identity.IsAuthenticated)
            {
                var scopes = new[] { this.options.Value.AttendeeScope ?? throw new ArgumentNullException(nameof(this.options.Value.AttendeeScope)) };
                var accessToken = await this.tokenAcquisition.GetAccessTokenForUserAsync(scopes);
                this.httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
                this.httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            }
        }