Authentication in asp.net core异常汇总

发布时间 2023-07-25 10:39:57作者: ChuckLu

  services.AddAuthentication("Microsoft")
            .AddMicrosoftIdentityWebApp(Configuration,"AzureAd","Microsoft");

InvalidOperationException: No sign-out authentication handler is registered for the scheme 'OpenIdConnect'. The registered sign-out schemes are: Cookies, Microsoft. Did you forget to call AddAuthentication().AddCookie("OpenIdConnect",...)?

 

 

 services.AddAuthentication("Microsoft")
            .AddMicrosoftIdentityWebApp(Configuration,"AzureAd");

  • 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).

    • Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties)

    • Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler+<>c__DisplayClass0_0+<<HandleAsync>g__Handle|0>d.MoveNext()

    • Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)

    • Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)

    • Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)