hey guys, is there a way to set this from email ad...
# help
k
hey guys, is there a way to set this from email address in the code? (cognito)
f
Hey @Kristian Lake, you can set i up like this in V1 construct:
Copy code
new Auth(this, "Auth", {
  cdk: {
    userPool: {
      email: cognito.UserPoolEmail.withSES({
        fromEmail: '<mailto:noreply@myawesomeapp.com|noreply@myawesomeapp.com>',
        fromName: 'Awesome App',
        replyTo: '<mailto:support@myawesomeapp.com|support@myawesomeapp.com>',
      }),
  },
});
Oh sorry.. I mis-read ur msg. The snippet above uses SES to send out the verification email.
If you want to use Cognito to send it out, there isn’t a “high-level” friendly way of doing it. You’d need to grab the CloudFormation resource and configure it directly like this:
Copy code
const auth = new Auth(this, "Auth");

// Get the CloudFormation resource of the UserPool
const cfnUserPool = auth.cdk.userPool.node.defaultChild;

// Set raw CloudFormation settings for email
cfnUserPool.emailConfiguration = {
  configurationSet,
  emailSendingAccount,
  from,
  replyToEmailAddress,
  sourceArn,
};
You can read more about what each field takes in the CloudFormation doc for User Pool https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-emailconfiguration.html
Let me know if that makes sense.
k
Thank you Frank. looking at this now! 🙂
only change was this // Get the CloudFormation resource of the UserPool const cfnUserPool = authStack.auth.cognitoUserPool.node.defaultChild; but now working thank you