Skip to content

NavigationManager.NavigateToLogout() stuck on authentication/logout-callback - reopen. #57202

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

Closed
1 task done
dean-azure opened this issue Aug 6, 2024 · 8 comments
Closed
1 task done
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue Status: No Recent Activity

Comments

@dean-azure
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

This is to reopen task 56732

Expected Behavior

Please reference 56732

Steps To Reproduce

Please reference 56732

Exceptions (if any)

No response

.NET Version

8.x

Anything else?

Here is the debug output requested on

56732

Debugoutput.zip

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Aug 6, 2024
@dean-azure
Copy link
Author

I was not able to respond promptly to 57632. I didn't see an option to reopen 57632 so attaching the requested debug output here.

@dean-azure
Copy link
Author

When I run in localhost, the front end logs out normally. Would you like the same debug out from localhost to compare with the log output i've attached from our test environment?

@dean-azure
Copy link
Author

Any updates?

@dean-azure
Copy link
Author

Any new updates?

@dean-azure
Copy link
Author

The comment "added to 9.0-rc2"
Does this mean the issue has been identified and part of an future release?

@halter73
Copy link
Member

Thanks for the debug logs. I am able to verify that I can publish and trim a Blazor WebAssembly app using AddOidcAuthentication with the latest 8.0.8 packages and get redirected to the default authentication/logged-out page after successfully handing a logout click. I can also confirm this logs me out.

However, I was able to reproduce something similar to your logs which abruptly end after handing logout-callback by going back to the /authentication/logout-callback?state=... page after successfully logging out. For comparison:

Your failed logs

dotnet.runtime.8.0.7.3bvrr6lyon.js:3 dbug: Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorViewCore[1]
      Processing action logout-callback.
dotnet.runtime.8.0.7.3bvrr6lyon.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 23 of type Telerik.Blazor.Components.RootComponent.TelerikFragmentContainer
dotnet.runtime.8.0.7.3bvrr6lyon.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 37 of type Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorView
dotnet.runtime.8.0.7.3bvrr6lyon.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 24 of type StoneX.CommoditySolutions.Frontend.Shared.Menu
dotnet.runtime.8.0.7.3bvrr6lyon.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 25 of type Microsoft.AspNetCore.Components.CascadingValue`1[StoneX.CommoditySolutions.Frontend.Shared.Menu]
dotnet.runtime.8.0.7.3bvrr6lyon.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 37 of type Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorView
dotnet.runtime.8.0.7.3bvrr6lyon.js:3 info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed. These requirements were not met:
      DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
dotnet.runtime.8.0.7.3bvrr6lyon.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 28 of type Microsoft.AspNetCore.Components.Authorization.AuthorizeView
EOF

Successful logs

dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorViewCore[1]
      Processing action logout-callback.
AuthenticationService.js:2 trce: Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService[0]
      completeSignOut: "https://localhost:7275/authentication/logout-callback?state=c6c20cbb148e4348b464d56b1e4d91b9"
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 23 of type Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorView
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 1 of type Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState
dotnet.runtime.js:3 info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed. These requirements were not met:
      DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 2 of type Microsoft.AspNetCore.Components.CascadingValue`1[System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Components.Authorization.AuthenticationState]]
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Routing.Tree.TreeRouter[1]
      Request successfully matched the route with name '(null)' and template '/authentication/{action}'
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.Routing.Router[2]
      Navigating to component BlazorWasmRemoteAuthentication.Pages.Authentication in response to path '/authentication/logout-callback' with base URI 'https://localhost:7275/'
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 4 of type Microsoft.AspNetCore.Components.Authorization.AuthorizeRouteView
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 6 of type Microsoft.AspNetCore.Components.Authorization.AuthorizeRouteView+AuthorizeRouteViewCore
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 14 of type Microsoft.AspNetCore.Components.Authorization.AuthorizeView
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 3 of type Microsoft.AspNetCore.Components.Routing.Router
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 7 of type Microsoft.AspNetCore.Components.LayoutView
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 4 of type Microsoft.AspNetCore.Components.Authorization.AuthorizeRouteView
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 5 of type Microsoft.AspNetCore.Components.Routing.FocusOnNavigate
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 8 of type BlazorWasmRemoteAuthentication.Layout.MainLayout
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 6 of type Microsoft.AspNetCore.Components.Authorization.AuthorizeRouteView+AuthorizeRouteViewCore
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 7 of type Microsoft.AspNetCore.Components.LayoutView
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 8 of type BlazorWasmRemoteAuthentication.Layout.MainLayout
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorViewCore[15]
      Logout redirect completed successfully.
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorViewCore[4]
      Navigating to authentication/logged-out.
...

Failed logs after revisiting logout-callback?state=...

dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorViewCore[1]
      Processing action logout-callback.
AuthenticationService.js:2 trce: Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService[0]
      completeSignOut: "https://localhost:7275/authentication/logout-callback?state=c6c20cbb148e4348b464d56b1e4d91b9"
2dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 23 of type Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticatorView
dotnet.runtime.js:3 info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed. These requirements were not met:
      DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
dotnet.runtime.js:3 dbug: Microsoft.AspNetCore.Components.RenderTree.Renderer[3]
      Rendering component 14 of type Microsoft.AspNetCore.Components.Authorization.AuthorizeView

In my case, this happens because the state url was cleared from local storage here when the state was read the first time the logout-callback was processed.

Debugging AuthenticationService.js

You'll notice I have an extra trace-level log for completeSignOut. If you enable trace-level logging, you should see that too. It might be worth adding a breakpoint inside of the completeSignOut in AuthenticationService.js to get a better idea was going on. If completeSignOut returns "OperationCompleted" rather than "Success", the RemoteAuthenticationService will skip any further processing.

If that doesn't give you enough information to resolve the issue on your own, we'll need a minimal repro that demonstrates the problem. You can omit the "Authority" and "ClientId" for the OIDC configuration, but it should otherwise be complete.

@halter73 halter73 added the Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue label Sep 14, 2024
@halter73 halter73 removed their assignment Sep 14, 2024
Copy link
Contributor

Thank you for filing this issue. In order for us to investigate this issue, please provide a minimal repro project that illustrates the problem without unnecessary code. Please share with us in a public GitHub repo because we cannot open ZIP attachments, and don't include any confidential content.

@halter73 halter73 removed this from the 9.0-rc2 milestone Sep 14, 2024
@dotnet-policy-service dotnet-policy-service bot added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Status: No Recent Activity labels Sep 14, 2024
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue Status: No Recent Activity
Projects
None yet
Development

No branches or pull requests

3 participants