11

My step:

  • I created user by calling the AdminCreateUser API.
  • I use my custom login form to do the first login
  • I change password (because I'm in FORCE_PASSWORD_CHANGE status) Now the user is CONFIRMED
  • Trigger doesn't fire.
jkeys
  • 3,803
  • 11
  • 39
  • 63
Deepak
  • 261
  • 1
  • 9

3 Answers3

8

Cognito does not trigger post confirm when the user is created with adminCreateUser or manually from Cognito dashboard.

Subash
  • 7,098
  • 7
  • 44
  • 70
  • Do you have any documentation proving that ? I'm not challenging your response. It totally makes sense, since well, is not getting triggered in my case as well, but is there anywhere in AWS where we can get that info from ? – Renan Cidale Feb 11 '21 at 15:44
  • 3
    The Cognito documents are quite poor. I have myself been exploring this for a bit and I can confirm this with my exploration. I have tested both scenarios and this is how it is. – Subash Feb 11 '21 at 23:49
  • This is correct, the adminCreateUser doesn't trigger the post confirm event. You can however trigger pre-sign up, check my other answer to this question for details and references. – Ragav Y Apr 19 '21 at 14:29
  • 2
    Unfortunately, this is correct. I've tried all of the configurations. Here's a list of those triggers that work: Pre Sign Up, Pre Authentication, Post Authentication. I've tried unticking the "confirm phone" and "confirm email" radio boxes, but it still won't work. I'm doing the same, and I need the user to provide data so that I can use the Lambda to pop that info into a db. This is too bad. – Bennybear May 30 '21 at 05:09
  • @Bennybear I need your exact behavior too. Actually, I need to set up a whole tenant for the user in that trigger. How'd you get around this quickly? signup on hosted UI? – Shawn Mclean Nov 22 '21 at 12:53
  • 1
    @ShawnMclean I created a signup script using the AWS CLI and used the Pre Sign Up trigger. I then used my Lambda to do my trickery. If you want to grab user info after they're done authenticating (after they submit a code or something) for your lambda, the best path is a signup using Amplify or the cognito identity SDK and using the Post Auth trigger. I hope that helps! – Bennybear Nov 22 '21 at 19:16
0

I am looking for the answer to this as well and I found this in the official documentation:-

You create custom workflows by assigning AWS Lambda functions to user pool triggers. When you use the AdminCreateUser API action, Amazon Cognito invokes the function that is assigned to the pre sign-up trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input.

So basically we need to attach the lambda function to the pre sign-up trigger if we are using the AdminCreateUser API action. Haven't checked if it works. Confirmation would be great!

Update:-

I tried it out myself and it does trigger the pre sign-up lambda function. So there's the confirmation!

Ragav Y
  • 1,662
  • 1
  • 18
  • 32
0

As the name suggests, it is post "confirmation" trigger. The user needs to confirm the email belongs to him/her. This is done by entering the OTP that cognito sends to the given email address. Once the user enters that OTP, the email address is confirmed and post confirmation trigger fires.

Do Use the hosted UI's "Signup" link to create the account

Do Not Use Cognito service's in-built user creation page. Use Admin API

Sandeep
  • 335
  • 1
  • 2
  • 24