Blazor RemoteAuthenticatorView stuck in "Completing login..." after "No matching state found" error
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
Hello I have a Blazor WASM application that implements OIDC authentication using [authentication library](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-authentication-library?view=aspnetcore-7.0&tabs=visual-studio). I'm having a problem when users return back to the previous login URL by pressing the browser back button. This issue is described in more detail here: https://github.com/IdentityModel/oidc-client-js/issues/940. Doing some debugging I noticed that indeed I'm getting a "No matching state found in storage" error from Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js.

This is expected behavior because the state is deleted from storage after successful login. What I would like to ask is a way to better handle this error. Right now it gets stuck Completing login... without showing any error to the user or the browser console. I would expect `RemoteAuthenticatorView` to switch to the `LogInFailed` RenderFragment and show the error that occurred.
What is the best way to handle this error?
### Expected Behavior
_No response_
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
_No response_
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.