3
votes

I'm experimenting with Cognito but I can't seem to figure out how to get Cognito to send a verification email to a user for them to verify their email address.

This is in my back-end server, where I've received the username, email, and password from a new user. I'm suppressing the message action because I don't want users to receive a temporary password. Instead, I want to set the password to what they've already provided me.

AdminCreateUserRequest adminCreateUserRequest = new AdminCreateUserRequest().withUserPoolId("<user pool ID>")
                .withUsername(registerUserRequest.getUsername())
                .withUserAttributes(new AttributeType().withName("email")
                        .withValue(registerUserRequest.getEmail()), new AttributeType().withName("email_verified")
                        .withValue("false"))
                .withMessageAction(MessageActionType.SUPPRESS);
awsCognitoIdentityProvider.adminCreateUser(adminCreateUserRequest);

AdminSetUserPasswordRequest adminSetUserPasswordRequest = new AdminSetUserPasswordRequest().withUserPoolId(<user pool ID>)
                .withUsername(registerUserRequest.getUsername())
                .withPassword(registerUserRequest.getPassword())
                .withPermanent(true);
awsCognitoIdentityProvider.adminSetUserPassword(adminSetUserPasswordRequest);

However, users are never receiving an email to verify their email address. In the user pool configuration, I have "Email" selected under "Which attributes do you want to verify?" and I've verified the email address I'm sending from in SES. Am I missing something here?

1
After using Signup as answered and still not getting sent make sure you checked SES to make sure the domain didn't bounce or sending pause for high % of bounced/complaints.Switcher

1 Answers

1
votes

If you use AdminCreateUser the account will always be created with a temporary password.

What you actually want is Signup.