No authenticationScheme was specified .NET Origin: Application & API OSI layer 7 · Application Last updated 13 Oct 2026

InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found

[Authorize] triggered a challenge, but no authentication handler/default scheme is configured.

Exact message you may see No authenticationScheme was specified, and there was no DefaultChallengeScheme foundNo authentication handler is registered for the scheme
Seen on: .NET

Meaning

AddAuthentication() was called without a default scheme, or not called at all, or UseAuthentication is missing. Specify a default scheme or set schemes on [Authorize].

Common causes

  • AddAuthentication() without default scheme
  • Authentication handler not registered (AddJwtBearer/AddCookie)
  • UseAuthentication/UseAuthorization order wrong

⚡ Quick fix

  1. Use AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
  2. Register the handler
  3. Call app.UseAuthentication() before app.UseAuthorization()

Detailed fix by platform

C#

  1. csharp
    builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer();
    app.UseAuthentication();
    app.UseAuthorization();

How to diagnose

  1. Registration — Schemes configured?
  2. Middleware — Order

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

401 — HTTP 401 Unauthorized (HTTP)401454 — 454 4.7.0 Temporary authentication failure (SMTP AUTH backend unavailable) (Email / SMTP)454535 5.7.3 — Microsoft 365: 535 5.7.3 Authentication unsuccessful (SMTP AUTH / client submission blocked) (Email / SMTP)535 5.7.3AADSTS50076 — Azure AD (Entra ID): AADSTS50076 / AADSTS50079 — multi-factor authentication required (Azure)AADSTS50076AADSTS50126 — AADSTS50126: Error validating credentials due to invalid username or password (Azure)AADSTS50126AADSTS700016 — Azure AD (Entra ID): AADSTS700016 Application not found in the directory (Azure)AADSTS700016Authentication failed — fatal: Authentication failed for 'https://github.com/x/y.git/' (Git)Authentication failedAuthentication token manipulation error — passwd: Authentication token manipulation error (Linux)Authentication token …No authen…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.