question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] No authenticationScheme was specified, and there was no DefaultChallengeScheme found in 1.9.2 release

See original GitHub issue

Hi,

I am getting No authenticationScheme was specified, and there was no DefaultChallengeScheme found issue in version 1.9.2. I literally have no changes apart from package upgrade.

Here is the full error.

{"ClassName":"System.InvalidOperationException","Message":"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).","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties)\r\n at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)\r\n at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2146233079,"Source":"Microsoft.AspNetCore.Authentication.Core","WatsonBuckets":null}

And app is working fine when I revert back to 1.9.1.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
jmprieurcommented, May 10, 2021

We’ll have a look at what changed (but I’m surprised as multi-scheme is what is coming next), and your code shoudn’t have worked in the previous version (as you don’t provide a default scheme in AddAuthentication Meanwhile, if you want to use the latest version:

services
    .AddAuthentication(OpenIdConnectDefault.AuthenticationScheme, o =>
    {
        o.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
        o.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
    })
    .AddMicrosoftIdentityWebApp(this.configuration.GetSection("AzureAd"));
0reactions
jennyf19commented, May 25, 2021

closing, but feel free to reopen @santosh-jallapuram

Read more comments on GitHub >

github_iconTop Results From Across the Web

No authenticationScheme was specified, and there was ...
I have a .NET Core 2.0 app and have a problem with authorization. I want to use custom authorization with special requests. Header...
Read more >
Migrate authentication and Identity to ASP.NET Core 2.0
InvalidOperationException : No authenticationScheme was specified, and there was no DefaultChallengeScheme found.
Read more >
ASP.Net Core "System.InvalidOperationException: No ...
ASP.Net Core "System.InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found.".
Read more >
MVC Areas not render _Layout - appsloveworld.com
Coding example for the question MVC Areas not render _Layout. ... No authenticationScheme was specified, and there was no DefaultChallengeScheme found ...
Read more >
ASP.NET Core - No authenticationScheme was specified ...
Today I encountered a strange issue in an ASP.NET Core Web API application. Although I didn't had authentication nor authorization ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found