AWS Cognito - PostSignUp Trigger Not Working
Asked Answered
S

2

13

i have a post signup trigger setup to store the user details in DynamoDb table. This works fine when the user signs up on their own through the front-end but the trigger is never invoked if the user is created through AdminCreateUser API. Our assumption was after the newly added user gets an email with a temporary password and logins through the front-end, Cognito will invoke the postsignup trigger.

Is that an expected behavior? And also, how do we address this issue?

Suk answered 14/2, 2020 at 18:55 Comment(0)
M
16

Although that's counter intuitive, seems that's the expected behavior.

Post Confirmation trigger is not invoked when a user is created via AdminCreateUser API.

Workaround could be to to use Post Authentication trigger and during processing of the fired event to check if cognito:user_status is FORCE_CHANGE_PASSWORD.

When a user is created using AdminCreateUser, status of the new user is set to FORCE_CHANGE_PASSWORD. Once user logs in and changes temporary password, status is changed to CONFIRMED.

Downside is that trigger is invoked after every login.

Manganate answered 5/5, 2020 at 8:54 Comment(5)
This is what I ended up doing. Thanks for your response, AWS should address this issue.Suk
@Emon: AWS already knows about this since 2017: forums.aws.amazon.com/thread.jspa?messageID=775800. Unfortunately they didn't resolve this issue stillTussore
For the record, I just ran into this issue. It's 2023. I'll now work on implementing the Post Authentication workaround as suggested above.Circumspection
Downside is that trigger is invoked after every login. So, that sounds like a terrible tradeoff!Goudy
AWS needs to fix this.Overwhelm
P
0

It really sucks but performing a regular SignUp command instead of AdminCreateUser on the server side is probably the least bad option...

Profiterole answered 21/8, 2024 at 20:27 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.