akreddy247
akreddy247

Reputation: 21

How to autoVerifyEmail in aws cognito after the user is signed up. Verify email in Cognito after later state

My use case:

I want to signup the user in AWS Cognito and want the user to continue through the process without verifying email during the signup process.

To achieve this, I am letting the user continue the process by adding "autoConfirmUser": "true" in Cognito Presignup trigger

In a Cognito post-confirmation trigger, I am sending a CustomVerificationEmail using SES to have him verify the email address.

When the user verifies his email (Status = verified) in SES, I would like to update the EmailVerified to true in Cognito. (Later for forgot password use-case)

How can I achieve this programmatically? Like a Lambda or something triggered by SNS?

I do not want to use AWS CLI like it mentioned in, AWS Cognito - User stuck in CONFIRMED and email_verified = false

Upvotes: 2

Views: 6631

Answers (1)

Saiful Azad
Saiful Azad

Reputation: 1901

Please add autoVerifyEmail to true in Cognito Presignup trigger.

Observe this referance

Example code in nodejs

"use strict";

exports.handler = async (event) => {
    event.response.autoConfirmUser = true;
    event.response.autoVerifyEmail = true; 
    return event;
};

Upvotes: 5

Related Questions