Bearer error="invalid_token", error_description="The token expired at '11/14/2026 01:03:01'"
means the token's exp time has passed. The client has to get a new token (log
in again or use its refresh token); nothing on the API is broken. The time in the message is
UTC, so compare it with UTC, not with your local clock.
A token that expired only a minute or two ago may still be accepted, because the handler
allows some clock skew. The test below shows a token two minutes past its expiry accepted
with the default settings and refused with ClockSkew set to zero.
The error
The response, from curl.exe -i, for a token that expired ten minutes earlier:
$token = .\mint\bin\Debug\net10.0\Mint.exe "fix11-test-only-signing-key-0123456789abcdef" https://issuer.test fix11-api -10 -20
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:13:01 GMT
Server: Kestrel
WWW-Authenticate: Bearer error="invalid_token", error_description="The token expired at '11/14/2026 01:03:01'"
The server console:
info: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[1]
Failed to validate the token.
Microsoft.IdentityModel.Tokens.SecurityTokenExpiredException: IDX10223: Lifetime validation failed. The token is expired. ValidTo (UTC): '14-11-2026 01:03:01', Current time (UTC): '14-11-2026 01:13:01'.
...
The response's Date header (01:13:01 GMT) and the log's "Current time (UTC)"
agree; the token had expired ten minutes before the request. The response and the log
print the same instant in two date formats.
Why it happens
The token maker was told to set exp ten minutes in the past (the
-10 argument) and nbf twenty minutes in the past. Lifetime
validation compares exp with the server's current UTC time and fails with
IDX10223.
Clock skew, as tested
A token that expired two minutes earlier, sent to the API with default settings (port 15600)
and to a second instance with ClockSkew set to zero seconds (port 15601):
$token = .\mint\bin\Debug\net10.0\Mint.exe "fix11-test-only-signing-key-0123456789abcdef" https://issuer.test fix11-api -2 -20
curl.exe -i http://127.0.0.1:15600/patients -H "Authorization: Bearer $token"
HTTP/1.1 200 OK
...
curl.exe -i http://127.0.0.1:15601/patients -H "Authorization: Bearer $token"
HTTP/1.1 401 Unauthorized
...
WWW-Authenticate: Bearer error="invalid_token", error_description="The token expired at '11/14/2026 01:11:41'"
The setting on the second instance, from the test's Program.cs:
parameters.ClockSkew = TimeSpan.FromSeconds(int.Parse(skew));
So with the defaults a token two minutes past exp passed, and ten minutes past it
failed. Only those two points were tested. If an integration test expects an expired token to
be refused right away, set ClockSkew to zero in that test.
The fix
A fresh token, made a moment later, against the zero-skew instance:
$token = .\mint\bin\Debug\net10.0\Mint.exe "fix11-test-only-signing-key-0123456789abcdef" https://issuer.test fix11-api 30 0
curl.exe -i http://127.0.0.1:15601/patients -H "Authorization: Bearer $token"
HTTP/1.1 200 OK
...
["Maria Garcia","David Chen"]
In an application the fix is on the client: refresh the token before exp, or
catch the 401 with error="invalid_token", fetch a new token and retry once.
How it was reproduced
A dotnet new web -f net10.0 API with Microsoft.AspNetCore.Authentication.JwtBearer
10.0.15 (Microsoft.IdentityModel 8.19.2) and one endpoint protected with
RequireAuthorization(), run twice (127.0.0.1:15600 with defaults, 15601 with
--Lab:ClockSkew=0) on the ASP.NET Core 10.0.15 runtime, SDK 11.0.100. A console
project on System.IdentityModel.Tokens.Jwt 8.19.2 made HS256 tokens whose expiry and
not-before are minutes from now; the key is a made-up test string. Requests went through
curl 8.22.0 on Windows.
Frequently asked
- Is the time in 'The token expired at' UTC or local time?
- UTC. In the test the message said 01:03:01 while the response Date header said 01:13:01 GMT, and the server log labelled both values UTC.
- Why does ASP.NET Core accept a JWT that has just expired?
- Clock skew. In the test a token two minutes past exp was accepted with the defaults and refused once ClockSkew was set to zero; a token ten minutes past exp was refused with the defaults.
- How do I fix IDX10223 The token is expired?
- Get a new token: log in again or use the refresh token, then resend the request. The API is working as configured; in the test a freshly minted token got a 200.
More decoded errors in the Fixes category. The opposite case, a token used before its start time, is IDX10222.