I'm trying to disable the verification process for some users that I register myself(admin).
I've added the pre-signup lambda like the documentation says:
```exports.handler = (event, context, callback) => {
// Confirm the user
event.response.autoConfirmUser = true;
// Set the email as verified if it is in the request
if (event.request.userAttributes.hasOwnProperty("email")) {
event.response.autoVerifyEmail = true;
}
// Set the phone number as verified if it is in the request
if (event.request.userAttributes.hasOwnProperty("phone_number")) {
event.response.autoVerifyPhone = true;
}
// Return to Amazon Cognito
callback(null, event);
};
And the email verification is still coming to the user.
I've also tried using the adminConfirmSignUp api to confirm the user right after I create it with adminCreateUser. But this is the error i'm getting when using the adminConfirmSignUp
{ NotAuthorizedException: User cannot be confirmed. Current status is FORCE_CHANGE_PASSWORD
Is there any other way that I can make it to not send the verification email to some users?
Amazon Cognito can automatically verify email addresses or phone numbers. To do this verification, Amazon Cognito sends a verification code or a verification link. For email addresses, Amazon Cognito can send a code or a link in an email message. For phone numbers, Amazon Cognito sends a code in an SMS text message.
Call the SignUp API action, and provide the email address and phone number for the UserAttributes parameter. At this point, Amazon Cognito sends a verification code to the user's phone. In your app interface, present a confirmation page where the user enters the verification code.
I got this to working by just including these 2 properties inside the request when creating the user.
DesiredDeliveryMediums: [],
MessageAction: "SUPPRESS"
No need for pre-signup lambda.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With