'Cognito Post Confirmation trigger

var params = {
  policyName: 'STRING_VALUE', /* required */
  target: 'STRING_VALUE' /* required */
};
iot.attachPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

I need to use above Method in a Lambda function to attach cognitoIdentityId with policyName https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Iot.html#attachPolicy-property. I have attached Cognito Post Confirmation trigger with a lambda function and getting event successfully. https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-post-confirmation.html I am looking for a way to get cognitoIdentityId using this event. Is there an API for this purpose or workaround to achieve this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source