[BUG] AWS SSO credentials expire hourly despite longer session duration configuration

Status Fixed / completed
Maintainer reply ✓ Yes — catherinewu
Activity 6 comments · opened Mar 22, 2025 · closed May 1, 2025
💡 Likely answer: A maintainer (catherinewu, contributor) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [X] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.53
  • Operating System: 24.04.2 LTS (GNU/Linux 5.15.167.4-microsoft-standard-WSL2 x86_64)
  • Terminal: Terminal

Bug Description

AWS SSO credentials expire prematurely in Claude Code despite longer configured session durations. Claude Code appears to only read credentials from ~/.aws/credentials once and doesn't implement the AWS SDK credential provider chain's refresh mechanism.

Steps to Reproduce

  1. Configure AWS SSO with session duration longer than 1 hour
  2. Configure AWS permission set duration longer than 1 hour
  3. Run aws sso login to authenticate
  4. Launch Claude Code and connect to Bedrock
  5. Use Claude Code for approximately 1 hour
  6. Observe error regarding invalid AWS credentials

Expected Behavior

Claude Code should respect the configured AWS SSO session duration and permission set duration, automatically refreshing credentials as needed without requiring manual re-authentication.

Actual Behavior

Claude Code reports invalid AWS credentials after approximately 1 hour, requiring manual re-authentication via aws sso login. This occurs despite AWS CLI and other AWS SDK tools in the same terminal session continuing to work fine with the same credentials. Restarting Claude Code does not fix the issue without running aws sso login again.

View original on GitHub ↗

6 Comments

koho-volodymyr · 1 year ago

Hi team (@bcherny maybe?), just wanted to bump this—this bug has been pretty disruptive in our workflow. Any chance it could get some attention soon? Really appreciate all the work you're doing and hope this can get prioritized. Thanks!

ghost · 1 year ago

Hi, could you try out latest (0.2.86) and see if the new version resolves this?

catherinewu contributor · 1 year ago

Hi @koho-volodymyr, @danielwells - This should be fixed in the latest release. Could you let us know if you still experience this issue?

koho-volodymyr · 1 year ago

@levpopov @catherinewu can confirm, it's been fixed already. Appreciate the quick change!

ghost · 1 year ago

thank you for confirming!

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.