validate cognito user created by Admin

0

Hi team, I have a lambda function that

  1. add a new user to Cognito user pool
  2. add that newly created user to a Cognito Group
  3. add user's information to a DynamoDB table

sometimes an error occurs, after step 1 or while adding the user to dynamo DB, so it ends with a situation where the user is added in Cognito but not to the group or not to the DynamoDB table.

is there a way to use a kind of transaction in a lambda function where we don't end up in an inconsistent state (user added in Cognito but no associated information in DDB table, if an error occurs after staep1)?

my second question is how can we validate a user added with AdminCreateUser API

using AdminCreateUser API call, my user is created with Force change password status, and then I want to send them a link( the default link of Cognito doesn't work) to verify their information and then validate the invitation. So how can I validate, in Cognito user pool, a user created with AdminCreateUser with the status Force change password using a custom link sent to the client?

Thank you team!!

1 個回答
2

One solution I would have for that is to first add the user to DynamoDB, and then use DynamoDB Streams and a Lambda to add the user to Cognito, if you fail at that point and you cannot add the user to Cognito for some reason, remove the DynamoDB item.

Hopefully someone with Cognito experience will be able to answer your second question.

profile pictureAWS
專家
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南