Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I was debugging the source code in my new company to find the origin of the
C#
OpenIdConnectProtocolInvalidNonceException


When the AuthenticationFailed notification is received, they check if User.Identity.IsAuthenticated

What I have tried:

When the exception is thrown, they get a AuthenticationFailed notification:
C#
Notifications = new OpenIdConnectAuthenticationNotifications
    {
        AuthenticationFailed = n =>
            {
               if(n.Exception is OpenIdConnectProtocolInvalidNonceException)
                  {    
                     // This is the confusing line
                     if(n.OwinContext.Authentication.User.Identity.IsAuthenticated)
                         {
                             n.SkipToNextMiddleware();
                             return Task.FromResult(0);
                          }
                  }
             }
     }


Can the user be authenticated on AuthenticationFailed notification?
Posted
Comments
Richard MacCutchan 5-Dec-20 5:35am    
Why not ask the people who wrote the code?
TempoClick 5-Dec-20 5:54am    
The whole team has been changed. We are now two new developers in place. Do you have an idea ifba user could still be authenticated on AuthenticationFailed notification?
Richard MacCutchan 5-Dec-20 6:09am    
Sorry, I do not know, and the MSDN documentation is not helpful.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900