I setup the automatic confirmation of email not to hang user in the signup-process too long.
But I could not find any way how to send the verification email afterwards (if I turned on the automatic confirmation option, the Cognito does not seem to send the verification email).
The official API (http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html#getUserAttributeVerificationCode-property) seems to only provide a way to send an email with verification code not a link.
Any tip?
The only option I could find was to use a lambda function triggered by Custom Message.
@ajaxon Thanks! I will look into that.
Specifically, you need to handle requests of "triggerSource":"CustomMessage_SignUp", and you must enrich the request with
"response":{
"smsMessage":".......",
"emailMessage":".........",
"emailSubject":"........."
}
and return the enriched request as a response. If the lambda takes too long to respond, Cognito will send the default verification message instead.
Here is what I have for now.
exports.handler = function(event, context) {
if(event.userPoolId === "<userpoolid>") {
if(event.triggerSource === "CustomMessage_SignUp") {
event.response.smsMessage = "Welcome to the service. Your confirmation code is " + event.request.codeParameter;
event.response.emailSubject = "Welcome to the service";
event.response.emailMessage = "Thank you for signing up. Please click the link below to confirm your email address. http://localhost:4200/authentication/confirm?code=" + event.request.codeParameter + "&username=" + event.request.userAttributes.email;
}
}
context.done(null, event);
};
@ajaxon I'll give it a try! Thanks!
@ohtangza Did you get this working? Kinda have the same issue.
The doc for this functionality, http://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html
Most helpful comment
Here is what I have for now.
exports.handler = function(event, context) {
};