Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor .net 8 Own Authentication

$
0
0

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 ?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>