8.2. Add Lambda trigger to Cognito

Since in this tutorial we are using both TypeScript and Python, we will take TypeScript as an example; if you are using Python, it will be similar.

First, go back to the Cognito console. In the Authentication section, select Extensions, then choose Add Lambda trigger.

8.2.1

In the Add Lambda trigger console, configure as follows:

  • Lambda triggers: select Authentication.
  • Authentication: select Pre token generation trigger.
  • Trigger event version: select Basic features + access token customization for user and machine identities - Recommended.

8.2.2

Next, select the Lambda function we created earlier and click Add Lambda trigger.

8.2.3

8.2.4