Provide failure details when token refresh fails in Blazor WebAssembly
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
Originally posted by @ascott18:
https://github.com/dotnet/aspnetcore/issues/40764#issuecomment-1781629719
> When the token refresh fails, the only thing propagated from JS back to C# is "RequiresRedirect" ([link](https://github.com/dotnet/aspnetcore/blob/ffa0a028464e13d46aaec0c5ad8de0725a4d5aa5/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/AuthenticationService.ts#L188C1-L196C14)). We cannot get any details of the failure, like the OAuth response object from the server (with error and error_description properties), or if the failure was a network error (i.e. "no internet").
>
> There doesn't seem to be a good place to configure a global handler for token refresh failures. The best I've managed was subclassing RemoteAuthenticationService and overriding RequestAccessToken, but this circles back to the first point where in the event of a failure in token acquisition, we cannot determine what the failure mode was. Example use case: token refresh fails because the user's account was disabled on the server. We want to immediately kick the user out of the app no matter what they were doing at the time.
Contributor guide
Assessment
This issue has not been assessed yet.