I have implemented my own authentification in MyAuthenticationStateProvider which derives from AuthenticationStateProvider.
In program.cs, I register this as
builder.Services.AddScoped<AuthenticationStateProvider, MyAuthenticationStateProvider>(serviceProvider => serviceProvider.GetRequiredService
The issue is only when I refresh the page in the browser which throws the exception
InvalidOperationException: Unable to find the required 'IAuthenticationService' service. Please add all the required services by calling 'IServiceCollection.AddAuthentication' in the application startup code. So, I am setting it up well enough for it to work, but not well enough for it to support page reload (ctrl+R in edge). This is the only way it fails, but it does, and I am absolutely confused about why.