Skip to content

InvalidClientException when using CreateTokenWithIAM for AWS Q Business Trusted Identity Propagation

0

I'm implementing Trusted Identity Propagation (TIP) for AWS Q Business integration and consistently receiving InvalidClientException when calling CreateTokenWithIAM. Both .NET SDK and AWS CLI return identical errors despite what appears to be correct configuration.

InvalidClientException: {"error":"invalid_client","error_description":"Invalid client provided"}

Configuration:

Identity Center Application:**

  • Application ARN: arn:aws:sso::************:application/ssoins-*************************************
  • Status: ENABLED
  • OAuth Grants: JWT Bearer ✅
  • Provider: Custom

Trusted Token Issuer:

  • Issuer URL: https://**************.cloudfront.net
  • Claim Mapping: sub → userName
  • JWKS Retrieval: OPEN_ID_DISCOVERY
  • Linked to Application ✅

JWT Claims:

{
  "sub": "userName",
  "email": "userEmailAddress", 
  "iss": "https://**************.cloudfront.net",
  "aud": "arn:aws:sso::************:application/ssoins-*************************************"
}

What I've Verified

✅ OIDC discovery endpoint returns 200 OK with application/json ✅ JWKS endpoint accessible with correct Content-Type ✅ JWT signature validates against JWKS ✅ Application has JWT Bearer grant configured ✅ Authorized audiences include the application ARN ✅ Identity Store user exists with matching username ✅ Tested both eu-west-1 (Identity Center) and us-east-1 (Q Business) regions ✅ IAM permissions for sso-oauth:CreateTokenWithIAM ✅ Waited 45+ minutes for propagation

Reproduction

Tested in both regions with identical results:

EU-West-1 (Identity Center region):

aws sso-oidc create-token-with-iam \
  --grant-type "urn:ietf:params:oauth:grant-type:jwt-bearer" \
  --client-id "arn:aws:sso::************:application/ssoins-*************************************" \
  --assertion file://jwt.txt \
  --region eu-west-1

US-East-1 (Q Business region):

aws sso-oidc create-token-with-iam \
  --grant-type "urn:ietf:params:oauth:grant-type:jwt-bearer" \
  --client-id "arn:aws:sso::************:application/ssoins-*************************************" \
  --assertion file://jwt.txt \
  --region us-east-1

Both regions return identical InvalidClientException. CloudTrail shows requests reach AWS with correct parameters, but no detailed error information beyond "Invalid client provided".

Question

What could cause CreateTokenWithIAM to return "Invalid client provided" when the application exists, has JWT Bearer grant enabled, and all configuration appears correct? Are there any hidden validation steps or propagation delays I might be missing?

Any insights would be greatly appreciated - thanks!

1 Answer
0

When encountering an "InvalidClientException" with the error message "Invalid client provided" while using CreateTokenWithIAM for AWS Q Business Trusted Identity Propagation, there are several potential issues to consider:

  1. Token Usage Limitation: The web identity token can only be used once with the CreateTokenWithIAM API to prevent token replay attacks. If you're attempting to reuse the same JWT multiple times, this will cause an error. Make sure you're generating a new JWT for each test.

  2. Client ID Format: Verify that the client_id parameter exactly matches the application ARN format required by IAM Identity Center. Even minor discrepancies can cause validation failures.

  3. JWT Configuration Issues:

  • Ensure your JWT's "aud" claim exactly matches the application ARN
  • Verify the "iss" claim matches exactly with the configured Trusted Token Issuer URL
  • Check that the "sub" claim maps correctly to an existing user in IAM Identity Center
  1. Identity-Aware Sessions: Confirm that identity-aware sessions are enabled in your organization's management account. This is required for Amazon Q Business to authenticate users and call APIs.

  2. SCIM Synchronization: If you're using an external IdP, ensure that users are properly synchronized to Identity Center through SCIM. Duplicate or missing users can cause authentication issues.

  3. Propagation Delays: Although you've waited 45+ minutes, some configuration changes in IAM Identity Center can take longer to fully propagate across all regions and services.

  4. Region Considerations: While you've tested in both regions, ensure that the region where you're making the CreateTokenWithIAM call is the same region where your IAM Identity Center instance is configured.

For troubleshooting, I recommend:

  • Generate a fresh JWT token for each test attempt
  • Double-check the exact format of all parameters, especially the client_id
  • Verify that identity-aware sessions are properly configured
  • Consider caching the temporary credentials generated by AWS STS AssumeRole for subsequent API calls rather than repeatedly calling CreateTokenWithIAM with new tokens

If the issue persists, examine CloudTrail logs more deeply for any additional context about the validation failure.
Sources
Configure Amazon Q Business with AWS IAM Identity Center trusted identity propagation | AWS Machine Learning Blog
Troubleshoot Amazon Q Business set up errors with IAM Identity Center | AWS re:Post
Access AWS services programmatically using trusted identity propagation | AWS Security Blog
CreateTokenWithIAM - AWS IAM Identity Center

answered a year ago

  • Based on the AI response above, I can confirm the following:

    ✅ Token reuse (I generate fresh JWTs) ✅ Client ID format (exact application ARN match) ✅ JWT claims (all correct) ✅ Identity-aware sessions (enabled) ✅ SCPs (not blocking) ✅ Region alignment (tested both)

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.