-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AuthorizationMessageHandler fails to set authenticationstate on error #30927
Comments
Thanks for contacting us. |
Hi @davhdavh. We made some changes in the RC2 .NET 6 release which may resolve this. Could you see if you're still encountering this issue with the If so, do you happen to have repro steps, or a basic repro repository I can try out?
What's the exception? |
Hi @TanayParikh |
Not sure what you mean by this. The The |
Correct, the problem is not inside AuthorizationMessageHandler. However, it does call _provider.RequestAccessToken. This is actually implemented in a class that DOES track authentication state, namely the AuthenticationStateProvider. The bug is that when RequestAccessToken fails inside AuthenticationStateProvider, it itself should detect that the authentication state is no longer valid so that code that depends on the AuthenticationStateProvider (which would be ALL default code in everyones projects) can inform the user that they were logged out. |
As I mentioned above:
Hence, by catching the If you don't feel that this sufficiently resolves the issue you're facing, feel free to put up a PR with your suggested change (I'm assuming this would be a minor change, let me know if not), and we'll evaluate accordingly whether the change would be appropriate for the framework. |
Describe the bug
If
_provider.RequestAccessToken
is unable to provide a valid token, theIAccessTokenProvider
API assumes that theRedirectUri
is followed and the authentication flow reapplied. However, theAuthorizationMessageHandler
class throws an exception because it cannot handle that flow.It should however also inform
IAccessTokenProvider
that the currentAuthenticationState
is no longer valid.Further technical details
.Net 6.0 preview 2
The text was updated successfully, but these errors were encountered: