Blazor WASM Logout Issue

Viewed 23

I have a Blazor WASM application deployed to Azure Blob storage as a static website. I am using Azure B2C authentication with Social Login and Email login. When I am running the code through Visual Studio, both login and logout work as expected. When I deploy the code to my static website on azure, login seems to work fine but logout has a problem. See the below screenshots.

Local Debugging

enter image description here

Static website

enter image description here

I am using the default RemoteAuthenticatorView in my code with no changes.

@page "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
<RemoteAuthenticatorView Action="@Action" />

@code{
    [Parameter] public string? Action { get; set; }
}

Below is the code for my LoginDisplay.razor component

@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication

@inject NavigationManager Navigation
@inject SignOutSessionStateManager SignOutManager

<AuthorizeView>
    <Authorized>
        Hello, @context.User.Identity?.Name!&nbsp;<MudDivider Vertical="true" FlexItem="true"></MudDivider>
        <MudButton Color="Color.Warning" @onclick="BeginLogout" EndIcon="@Icons.Filled.Logout">Log out</MudButton>
    </Authorized>
    <NotAuthorized>
        <MudButton Color="Color.Tertiary" Link="authentication/login" StartIcon="@Icons.Filled.Login">Login</MudButton>
    </NotAuthorized>
</AuthorizeView>

@code{
    private async Task BeginLogout(MouseEventArgs args)
    {
        await SignOutManager.SetSignOutState();
        Navigation.NavigateTo("authentication/logout");
    }
}

What am I missing?

0 Answers
Related