Skip to content

Logout does not work when using AddOidcAuthentication #31088 #46489

@tbone95

Description

@tbone95

Is there an existing issue for this?

  • I have searched the existing issues and yes there is, I've linked it below.

Describe the bug

This issue - #31088 (comment) is happening for me as well. The logout works fine when I'm on the root page, however, if I'm on any other page it won't work and I get the same error as this original post.
Using .NET 7.0 and OIDC.

I'm using the NavigateToLogout method like below.

Within the LoginDisplay.

<AuthorizeView>
    <Authorized>
        <span class="currentuser-details-section dark:text-dark-mode-text cursor-pointer" @onclick="SwitchTheme">User: @context.User.Identity?.Name</span>        
        <button class="nav-link btn btn-link" @onclick="BeginSignOut">(Log out)</button>
    </Authorized>
</AuthorizeView>

Code Behind

private void BeginSignOut(MouseEventArgs args)
    {
        this.NavigationManager.NavigateToLogout("authentication/logout");
    }

Expected Behavior

Should logout from any page.

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

7.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions