amazon-archives / amazon-cognito-identity-js

Amazon Cognito Identity SDK for JavaScript
Other
984 stars 454 forks source link

How to use the Lambda triggers in cognito-identity-js #673

Closed engharb closed 6 years ago

engharb commented 6 years ago

Hello, I have created a new lambda function as:

exports.handler = function(event, context) {
    if ((event.request.userAttributes.email_verified === false) || (event.request.userAttributes["email_verified"] === false)) {
        var error = new Error('Cannot authenticate users from this client');
        console.log("Testing Error");
        return context.done(error, event);
    }
    console.log("Testing Error****");
    return context.done(null, event);
};

I want to test if the user email is verified or not, and trigger such function pre-auth/pre-signin.

I have added/activated this trigger in my user pool, but it is not called at all.

Do I have mistakes in my code?

Any suggestions please?

Regards,