Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to require email validation in Cognito through CloudFormation?

Tags:

I think I tried all properties here:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html

couldn't get this box checked:

enter image description here

My config currently:

    CognitoUserPoolGeneral:       Type: AWS::Cognito::UserPool       Properties:         UserPoolName: general         Policies:           PasswordPolicy:             MinimumLength: 6             RequireLowercase: false             RequireNumbers: false             RequireSymbols: false             RequireUppercase: false         Schema:           - AttributeDataType: String             Name: preferredLocale             DeveloperOnlyAttribute: false             Mutable: true             Required: false         EmailVerificationMessage: "Here's your verification code: {####}. Please provide it inside the application."         EmailVerificationSubject: "subject" 
like image 719
Daniel Birowsky Popeski Avatar asked Oct 27 '17 10:10

Daniel Birowsky Popeski


People also ask

How do I verify my email on AWS Cognito?

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.

How do I set up authentication in Cognito?

Go to AWS Cognito service and click “Manage Identity Pools”. 2. Enter “Identity pool name”, expand the “Authentication providers” section and select “Cognito” tab. This is where the Cognito authentication provider will be registered with the Identity pool.

How do I send an email using Cognito?

Choose User Pools. Choose an existing user pool from the list. Choose the Messaging tab, locate Email configuration, choose Edit. On the Edit email configuration page, select Send email from Amazon SES or Send email with Amazon Cognito.

Can we update email in Cognito?

I am using aws cognito user pool in my application and users can log in to the app using their email that verified in aws cognito. Users can change login email and the users must verify the new email.


1 Answers

You can add

  AutoVerifiedAttributes:     - email 

To your Properties key, like so:

  UserPool:     Type: "AWS::Cognito::UserPool"     Properties:       UserPoolName: !Sub ${AuthName}-user-pool       AutoVerifiedAttributes:         - email       Policies:..... 

For an excellent example of a CloudFormation template that creates Cognito resources, see:

https://gist.github.com/singledigit/2c4d7232fa96d9e98a3de89cf6ebe7a5

like image 166
Mike Patrick Avatar answered Oct 13 '22 20:10

Mike Patrick