A 401 with only WWW-Authenticate: Bearer, no error and no error_description, is what this test API sent to a request with no Authorization header, to one with a Basic header and to one with the header name misspelled. None of them carried a Bearer token, and the server log had no validation line for them. Send the token in an Authorization: Bearer <token> header and the request is accepted.

This is the difference to read in the header. In a rerun on the same API, a request with a token signed by another key got Bearer error="invalid_token", error_description="The signature key was not found" and an IDX10517 line in the log; the requests without a Bearer token got the bare word Bearer and no IDX line. The host https://issuer.test, the audience fix11-api, the ports and the project names api2 and mint2 are the test's own.

The error

curl.exe -i http://127.0.0.1:15600/patients
HTTP/1.1 401 Unauthorized
Content-Length: 0
Date: Sat, 14 Nov 2026 01:26:30 GMT
Server: Kestrel
WWW-Authenticate: Bearer
curl.exe -i http://127.0.0.1:15600/patients -H "Authorization: Basic bWFyaWE6dGVzdA=="
HTTP/1.1 401 Unauthorized
Content-Length: 0
Date: Sat, 14 Nov 2026 01:26:30 GMT
Server: Kestrel
WWW-Authenticate: Bearer

The Basic value is a made-up test string. At the test's log levels (Microsoft.AspNetCore.Authentication at Information), the server console shows only the challenge, with no reason, once for each of the two requests:

info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[12]
      AuthenticationScheme: Bearer was challenged.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[12]
      AuthenticationScheme: Bearer was challenged.

A second instance on port 15604 with that category at Debug printed one more line for each of the two requests, still without a reason:

dbug: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[9]
      AuthenticationScheme: Bearer was not authenticated.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[12]
      AuthenticationScheme: Bearer was challenged.
dbug: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[9]
      AuthenticationScheme: Bearer was not authenticated.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[12]
      AuthenticationScheme: Bearer was challenged.

Why it happens

The endpoint has RequireAuthorization() and the only scheme is JWT bearer. For these requests the handler's Debug line says only Bearer was not authenticated., with no "Failed to validate the token" line and no IDX code. A rerun on port 15605 with Microsoft.AspNetCore.Authorization at Information showed the step in between:

info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed. These requirements were not met:
      DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[12]
      AuthenticationScheme: Bearer was challenged.

The same rerun tried two spellings. A misspelled header name got the bare answer; the scheme word in lower case was accepted:

curl.exe -i http://127.0.0.1:15605/patients -H "Authorisation: Bearer $token"
HTTP/1.1 401 Unauthorized
...
WWW-Authenticate: Bearer
curl.exe -i http://127.0.0.1:15605/patients -H "Authorization: bearer $token"
HTTP/1.1 200 OK
...

So when you see this, look at the client, not at keys or claims: in these runs the header was missing, misspelled or used another scheme.

The fix

$token = .\mint2\bin\Debug\net10.0\Mint.exe "fix11-test-only-signing-key-0123456789abcdef" https://issuer.test fix11-api 30
curl.exe -i http://127.0.0.1:15600/patients -H "Authorization: Bearer $token"
HTTP/1.1 200 OK
...
["Maria Garcia","David Chen"]

The token comes from the test's own token maker and its made-up key. In your client, log the outgoing Authorization header of the failing request once and compare it with the line above: one Bearer, one space, the token.

How it was reproduced

A copy of the batch's first API project (made with dotnet new web -f net10.0) with Microsoft.AspNetCore.Authentication.JwtBearer 10.0.15 (Microsoft.IdentityModel 8.19.2) and one endpoint protected with RequireAuthorization(), on 127.0.0.1:15600 (Information), 15604 (Debug for Microsoft.AspNetCore.Authentication) and 15605 (the same plus Microsoft.AspNetCore.Authorization at Information), ASP.NET Core 10.0.15 runtime, SDK 11.0.100. Tokens came from a copy of a console project made with dotnet new console, on System.IdentityModel.Tokens.Jwt 8.19.2; requests went through curl 8.22.0 from Windows PowerShell 5.1.

Frequently asked

Why does my ASP.NET Core API return 401 with just WWW-Authenticate: Bearer?
In this test it was the answer to requests without a Bearer token: no Authorization header, a Basic header, or a misspelled header name. The server logged no validation failure for them.
What is the difference between WWW-Authenticate: Bearer and error="invalid_token"?
In these runs the bare Bearer came back when no Bearer token was sent. A token signed with another key got invalid_token with The signature key was not found, and the log held IDX10517.
How do I see why JWT authentication returned 401 with no error?
In this set-up the handler logged only Bearer was not authenticated at Debug, and the Authorization category at Information added Requires an authenticated user. Check that the client sends Authorization: Bearer and the token.

More decoded errors in the Fixes category. When the header does say invalid_token, the description names the check, for example The signature key was not found.