Hier ist der Codeausschnitt:
Code: Select all
[SupplyParameterFromQuery]
private string Otp { get; set; } = default!;
[Inject]
SignInManager SignInManager { get; set; } = default!;
protected override async Task OnInitializedAsync()
{
try
{
if (HttpMethods.IsGet(HttpContext.Request.Method))
{
await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
}
if (!string.IsNullOrEmpty(Otp))
{
// Validate and get the user and claims
await SignInManager.SignInWithClaimsAsync(user, isPersistent: false, claims);
NavigationManager.NavigateTo("/test");
}
else
{
NavigationManager.NavigateTo("/error");
}
await base.OnInitializedAsync();
}
catch (Exception)
{
NavigationManager.NavigateTo("/error");
}
}
Code: Select all
Microsoft.AspNetCore.Components.NavigationException: 'Exception of type 'Microsoft.AspNetCore.Components.NavigationException' was thrown.'