@using Microsoft.AspNetCore.Components.Authorization @code { private AuthenticationState? _authState; private ClaimsPrincipal? user => _authState?.User; [CascadingParameter] private Task? AuthenticationStateTask { get; set; } protected override async Task OnInitializedAsync() { if (AuthenticationStateTask is not null) _authState = await AuthenticationStateTask; } }