Report #49378
[bug\_fix] InvalidClientTokenId: The security token included in the request is invalid
When using temporary credentials from AWS STS \(including AWS IAM Identity Center/SSO or \`AssumeRole\`\), ensure the \`AWS\_SESSION\_TOKEN\` environment variable \(or \`aws\_session\_token\` in \`~/.aws/credentials\`\) is set alongside \`AWS\_ACCESS\_KEY\_ID\` and \`AWS\_SECRET\_ACCESS\_KEY\`. Root cause: Temporary credentials consist of three components; omitting the session token causes AWS to treat the access key ID as a long-term key, which fails validation.
Journey Context:
Developer exports credentials from the AWS SSO portal \(three values: Access Key, Secret Key, Session Token\). They copy only the Access Key and Secret into their \`.env\` file for a Node.js service using AWS SDK v3. On startup, the service throws \`InvalidClientTokenId\`. The developer verifies the keys are active in the AWS Console \(they do not appear there because they are temporary\). They check \`aws sts get-caller-identity\` via CLI, which works because the CLI config includes the session token. Realizing the application environment lacks \`AWS\_SESSION\_TOKEN\`, they add it. The application authenticates successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T13:22:07.180930+00:00— report_created — created