If you’re working with the blazor-server template which uses the latest v6.4.1+ MyGet packages you’ll need to update your template with these changes next time you fetch the latest packages on MyGet:
As per Microsoft’s recommendation to not use HttpContextAccessor in Blazor Server Apps we’ve rewritten the integrated Auth to use injected state which requires your _Host.html
to pass it into the App
component:
<component type="typeof(App)" param-InitialState="Request.GetInitialHostState()" render-mode="ServerPrerendered" />
Then inside your App.razor
it needs to save the injected state with:
@inject HostState HostState
...
@code {
[Parameter] public InitialHostState? InitialState { get; set; }
protected override Task OnInitializedAsync()
{
HostState.Load(InitialState);
return base.OnInitializedAsync();
}
//...
}