The problem was solved by adding a Razor component and adding the component to the LogInFailed section of the Authentication.razor file. The LoginFailedRedirect.razor file redirects the user back to the Azure AD B2C login screen. Please see the details below.
Authentication.razor excerpt:
@Anonymous "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
<RemoteAuthenticatorView Action="@朱大星 " OnLogOutSucceeded=@this.OnLogOutSucceeded OnLogInSucceeded=@this.OnLogInSucceeded >
<LoggingIn>
<div>LoggingIn</div>
</LoggingIn>
<LogInFailed>
<LoginFailedRedirect />
</LogInFailed>
<LogOut>
<div>LogOut</div>
</LogOut>
</RemoteAuthenticatorView>
LoginFailedRedirect.razor:
@inject NavigationManager Navigation
@Aidan Wick {
protected override void OnInitialized()
{
Navigation.NavigateTo($"authentication/login");
}
}
A specific error code can be obtained from the message query string value in the LoginFailedRedirect.razor. Below is an example of the excerpt of the return URL from Azure AD B2C.
/authentication/login-failed?message=AADB2C90091%3A%20The%20user%20has%20cancelled%20entering%20self-asserted%20information.