Bearer error="invalid_token", error_description="The token has no expiration", with IDX10225: Lifetime validation failed. The token is missing an Expiration Time. in the log, means the token has no exp claim. Give every token an expiry when you create it, and the API accepts it with lifetime validation still on.

A token without exp would be valid forever if it were accepted. The API's default settings refused it in this test; keep them that way and fix the code that makes the token. https://issuer.test, fix11-api, the ports and the projects api2 and mint2 are the test's own.

The error

The test's token maker takes - as the expiry argument to leave exp (and nbf) out:

$token = .\mint2\bin\Debug\net10.0\Mint.exe "fix11-test-only-signing-key-0123456789abcdef" https://issuer.test fix11-api -
curl.exe -i http://127.0.0.1:15600/patients -H "Authorization: Bearer $token"
HTTP/1.1 401 Unauthorized
Content-Length: 0
Date: Sat, 14 Nov 2026 01:26:32 GMT
Server: Kestrel
WWW-Authenticate: Bearer error="invalid_token", error_description="The token has no expiration"

The server console:

info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[1]
      Failed to validate the token.
      Microsoft.IdentityModel.Tokens.SecurityTokenNoExpirationException: IDX10225: Lifetime validation failed. The token is missing an Expiration Time. Tokentype: 'Microsoft.IdentityModel.JsonWebTokens.JsonWebToken'.
...

Why it happens

The token maker builds a JwtSecurityToken and passes expires; with the - argument it passed null, and the API then found no expiration time in the token. The API's TokenValidationParameters do not mention lifetime at all, so the check ran with its defaults and refused the token.

So look at the code that creates the token, not at the API: find the place that sets the expiry and check what value it received. The client gets only the short description in the WWW-Authenticate header; the IDX10225 line, which also names the token type, is in the server console at Information level for Microsoft.AspNetCore.Authentication.

The fix

The token maker's code, from the test's Program.cs:

...
int? expires = args[3] == "-" ? null : int.Parse(args[3]);
...
    notBefore: expires is null ? null : now,
    expires: expires is null ? null : now.AddMinutes(expires.Value),
    signingCredentials: new SigningCredentials(signingKey, alg));
...

A token with a 30-minute expiry:

$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"]

Switching RequireExpirationTime off on the API (not run here) is aimed at this check. The cost is a token that never expires, so a leaked one keeps working; that is why it is not the fix.

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), one endpoint protected with RequireAuthorization(), on 127.0.0.1:15600 with no lifetime settings of its own, ASP.NET Core 10.0.15 runtime, SDK 11.0.100. The token came from a copy of a console project made with dotnet new console, on System.IdentityModel.Tokens.Jwt 8.19.2 with a made-up test key; requests went through curl 8.22.0 on Windows.

Frequently asked

What does IDX10225 The token is missing an Expiration Time mean?
The JWT has no exp claim and the API validates the lifetime. In the test a token built with expires set to null got this in the log and a 401.
Why does ASP.NET Core say 'The token has no expiration'?
That is the response text for IDX10225. In the test the API used the default lifetime settings, and they refused a token without exp.
How do I fix a JWT with no expiration?
Set an expiry when the token is created. In the test a token with expires 30 minutes from now got a 200 from the same API.

More decoded errors in the Fixes category. A token that has an expiry in the past is The token expired at (IDX10223).