Report #9021
[bug\_fix] The security token included in the request is expired \(ExpiredToken\)
Re-authenticate by running \`aws sso login\` \(for SSO\) or re-run \`aws sts assume-role\` to obtain fresh temporary credentials. The root cause is that STS temporary credentials have a fixed expiration \(default 1 hour for roles, 8\+ hours for SSO\) and are not automatically refreshed by the CLI/SDK when stored in ~/.aws/credentials or SSO cache.
Journey Context:
Developer authenticates via AWS SSO in the morning, runs several CLI commands successfully, then leaves the terminal idle for several hours. Upon returning, they run \`aws s3 ls\` and receive 'The security token included in the request is expired'. They check \`~/.aws/sso/cache/\` and see the \`expiresAt\` field is in the past. They attempt to export new environment variables manually but fail. Eventually, they run \`aws sso login\` again, which refreshes the SSO token and writes new temporary credentials to the cache, resolving the issue. The fix works because the SSO OIDC token itself expired, requiring a new browser-based authentication flow to re-establish the session.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:09:35.256911+00:00— report_created — created