Report #97781
[bug\_fix] AWS CLI: Unable to locate credentials / SSO token has expired when using an IAM Identity Center profile
Run \`aws sso login --profile \` \(or \`aws sso login --sso-session \`\) to refresh the cached SSO token. For automation, switch to a service role or long-term IAM credentials; SSO browser tokens cannot be refreshed non-interactively once expired.
Journey Context:
You configured AWS CLI v2 with an IAM Identity Center profile last week and ran \`aws sso login\`. Today a script using \`--profile dev\` fails with \`Unable to locate credentials\` or an expired-token error. You check \`~/.aws/sso/cache/\` and the token file timestamp is old. The AWS docs explain that the SSO access token cached by \`aws sso login\` is separate from AWS credentials and has its own expiration; once it expires, the CLI cannot silently refresh it without a browser sign-in. Running \`aws sso login --profile dev\` re-authenticates through the browser, writes a new token to \`~/.aws/sso/cache\`, and the CLI can again call \`sso:GetRoleCredentials\` to obtain temporary AWS credentials. If this is automation, the real fix is to stop using interactive SSO and use a service role or IAM keys because SSO tokens are designed for humans.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:41:52.771495+00:00— report_created — created