SSO login works in the browser but `aws sso login` hangs or gives `Error loading SSO Token: Token for ... does not exist`.
IntermediateTroubleshootingIAM and Access Errors
Answer
Likely causes → Missing or stale cache in ~/.aws/sso/cache, wrong sso_session, or a headless terminal.
Diagnose →
cat ~/.aws/config
ls ~/.aws/sso/cache
aws sso login --profile dev --use-device-code --debug
Fix →
- Remove stale cache files and log in again
- Use
--use-device-codeon remote machines - Verify
sso_regionandsso_start_url
Prevent → Use aws configure sso-session templates for the team.
More on IAM and Access Errors
`An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied` for a user who has S3 read access. What is wrong?Beginner`ExpiredToken: The security token included in the request is expired` in a long CI job. How do you fix it?Beginner`User: arn:aws:sts::111111111111:assumed-role/dev/bob is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::222222222222:role/deploy`. Why?Intermediate`An error occurred (AccessDenied) ... because no identity-based policy allows the s3:GetObject action` yet a bucket policy allows the user. Cross-account?IntermediateIAM policy validation: `MalformedPolicyDocument: Policy document should not specify a principal`. What happened?Intermediate`The security token included in the request is invalid` when using `aws` CLI.Beginner