In the Blazor (server side) I use AuthenticationStateProvider to set the authentication details in the session and restore it. Everything works perfecly with AuthorizeView but when I want to use Authorize attribute I am getting following error.
InvalidOperationException: Unable to find the required 'IAuthenticationService' service. Please add all the required services by calling 'IServiceCollection.AddAuthentication' in the application startup code.When I add builder.Services.AddAuthenticationCore(); I am getting the next error.
InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found. The default schemes can be set using either AddAuthentication(string defaultScheme) or AddAuthentication(Action<AuthenticationOptions> configureOptions).I do not want to use builder.Services.AddAuthentication as it forces to me use authentication handler (like AddCookie()).
I want to use AuthenticationStateProvider for authentication handling. Is there any ready solution for that ?