AWS Cognito Pre authentication/Define Auth Challen

2019-07-25 09:47发布

问题:

I'm essentially trying to create a middleware that will do some work before logging a user in. However, none of the lambda hooks run when I try to log in with a user that doesn't exist in aws cognito.

回答1:

This is expected. Before calling the pre-authentication trigger, Cognito checks to see if the user exists. This is so that it can pass required information like 'sub', 'email', 'phone' etc. to the triggers. Now, when you put the wrong user in the UI, the Cognito check results in a 'User does not exist' error.