in src/Relecloud.Web.CallCenter/Services/RelecloudApiServices/RelecloudApiConcertService.cs [225:241]
private async Task PrepareAuthenticatedClient()
{
if (this.httpContextAccessor.HttpContext is { User.Identity.IsAuthenticated: true } context)
{
try
{
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"));
}
catch (MicrosoftIdentityWebChallengeUserException)
{
await context.ChallengeAsync();
}
}
}