Report #6148
[bug\_fix] InvalidClientTokenId: The security token included in the request is invalid
When using temporary credentials from STS AssumeRole, ensure the \`AWS\_SESSION\_TOKEN\` environment variable is exported alongside \`AWS\_ACCESS\_KEY\_ID\` and \`AWS\_SECRET\_ACCESS\_KEY\`. If using a credentials file, ensure the \`aws\_session\_token\` key is present under the profile.
Journey Context:
A developer assumes a role using \`aws sts assume-role\` and exports the \`AccessKeyId\` and \`SecretAccessKey\` from the JSON response into environment variables. They run a script using the AWS SDK and immediately get InvalidClientTokenId. They check the error message and realize it mentions a security token. They look back at the STS output and see there is a \`SessionToken\` field they ignored. They recall that temporary credentials require the session token to be included in the signature calculation. They export \`AWS\_SESSION\_TOKEN\` with the value from the JSON, run the script again, and the SDK successfully signs the request with the session token, allowing the AssumeRole credentials to work.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:15:13.480298+00:00— report_created — created