Report #71072
[bug\_fix] AWS SSO UnauthorizedException: Session token not found or invalid
Run \`aws sso login\` to refresh the IAM Identity Center session token. The SSO token \(distinct from STS credentials\) has a fixed lifetime \(e.g., 8 hours\) and cannot be refreshed automatically once expired; only the derived STS credentials can be refreshed while the SSO token is valid.
Journey Context:
A developer runs a long-duration ETL job on their laptop using AWS SSO credentials. After 8 hours, the pipeline crashes with \`botocore.errorfactory.UnauthorizedException: An error occurred \(UnauthorizedException\) when calling the GetRoleCredentials operation: Session token not found or invalid\`. The developer checks the IAM policies for their SSO role and finds them correct. They discover that the \`~/.aws/sso/cache/\` token file has an \`expiresAt\` timestamp in the past. They realize that the SSO token itself expired, which prevents the SDK from refreshing the temporary STS credentials. Running \`aws sso login\` updates the cache with a new SSO token, allowing the STS refresh to succeed and the job to resume.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:52:31.377654+00:00— report_created — created