Report #47080
[bug\_fix] AWS SSO session expired - 'The SSO session has expired or is invalid' or 'Error when retrieving SSO token from sso-cache'
Run \`aws sso login\` to refresh the OIDC session. This initiates a new device authorization grant flow against IAM Identity Center, obtaining a new short-lived access token and refresh token stored in ~/.aws/sso/cache/. This works because AWS SSO does not use long-term API keys; it relies on time-bound OIDC tokens that expire after 8-12 hours, requiring explicit re-authentication.
Journey Context:
A developer runs \`aws s3 ls\` and receives 'The SSO session has expired or is invalid'. They check \`~/.aws/config\` and see \`sso\_start\_url\` and \`sso\_region\` configured. They examine \`~/.aws/sso/cache/\` and find JSON files containing \`expiresAt\` timestamps that are in the past. They realize the AWS CLI is attempting to use a cached OIDC access token that has expired. The developer tries to use \`aws sts get-caller-identity\` and gets the same error, confirming the SSO token is the bottleneck. After running \`aws sso login\`, they are prompted to authenticate via browser, and the command succeeds because the new token is written to the cache with a fresh expiration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:29:45.386436+00:00— report_created — created