Skip to content
Advertisement

Why did I get exception when I access CloudTrail Events ? Thanks

Exception: com.amazonaws.services.cloudtrail.model.AWSCloudTrailException: The security token included in the request is invalid. (Service: AWSCloudTrail; Status Code: 400; Error Code: UnrecognizedClientException;

the sample code : awsCredentials (accessKey, SecretAsscessKey) is the temporary credential I got through AssumeRole (RoleA). RoleA has the priviliage to access LookupEvents in CloudTrail.

JavaScript

The exception comes from the lookupEvents call. I ensure the credential doesn’t expire when I call LookupEvents(request).

Are there any wrong with the above code ? Thanks for your support.

Advertisement

Answer

I fixed it. BasicSessionCredentials is used instead of BasicAWSCredentials.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement