Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

The description of a Cognito User Pools Pre Sign-up Lambda Trigger is:

This trigger is invoked when a user submits their information to sign up, allowing you to perform custom validation to accept or deny the signup request.

I want to deny a sign-up request based on a certain condition in my Lambda. The trigger parameters (reproduced from the docs below) seem to only support auto-verification and auto-confirmation:

{

    "request": {

        "userAttributes": {

            "string": "string",

            ....

        },

        "validationData": {

            "string": "string",

            "string": "string",

             ....

        }

    },

    "response": {

        "autoConfirmUser": "boolean",

        "autoVerifyPhone": "boolean",

        "autoVerifyEmail": "boolean"

    }

}

How can I accept or deny a sign-up request based on the outcome of the Pre Sign-up Lambda Trigger?

1 Answer

0 votes
by (44.4k points)

To deny a signup request, you can simply return an empty dict and return an event value in a dict which will accept the signup request.

def lambda_handler(event, context):

    if denySignUp:

        return {}

    else:

        return event

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

Browse Categories

...