如何通过CloudFormation在Cognito中要求电子邮件验证?

时间:2017-10-27 10:48:48

标签: amazon-web-services amazon-cloudformation amazon-cognito aws-cognito

我想我在这里试过所有的房产:

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

无法检查此框:

enter image description here

我的配置目前:

    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"

1 个答案:

答案 0 :(得分:17)

您可以添加

  AutoVerifiedAttributes:
    - email

Properties键,如下:

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

有关创建Cognito资源的CloudFormation模板的优秀示例,请参阅:

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