-
Notifications
You must be signed in to change notification settings - Fork 798
Open
Labels
EnhancementNew feature or requestNew feature or request
Description
We might want a bit more error trapping ...
@halter73 @mikekistler Does adding ReplyForbiddenWithWwwAuthenticateHeaderAsync
trapping on MicrosoftIdentityWebChallengeUserException
and MsalUiRequiredException
make sense to roll into ☝️ of the Entra BFF sample?
Something like ...
string accessToken;
try
{
accessToken = await tokenAcquisition.GetAccessTokenForUserAsync(
scopes, user: httpContext.User);
}
catch (MicrosoftIdentityWebChallengeUserException exception)
{
await tokenAcquisition.ReplyForbiddenWithWwwAuthenticateHeaderAsync(
exception.Scopes, exception.MsalUiRequiredException, httpContext.Response);
return;
}
catch (MsalUiRequiredException exception)
{
await tokenAcquisition.ReplyForbiddenWithWwwAuthenticateHeaderAsync(
scopes, exception, httpContext.Response);
return;
}
if (!string.IsNullorEmpty(accessToken))
{
transformContext.ProxyRequest.Headers.Authorization = new("Bearer", accessToken);
}
Issue Details
⚠ Do not edit this section. It is required for issue processing.
- Content Source: dotnet/blazor-samples
- GitHub Login: @guardrex
Metadata
Metadata
Assignees
Labels
EnhancementNew feature or requestNew feature or request