【问题标题】:Unable to create a AWS Cognito User Pool user无法创建 AWS Cognito 用户池用户
【发布时间】:2017-12-03 10:55:50
【问题描述】:

我正在尝试使用 Cognito 用户池控制台(我正在设置用户名和临时密码的值)创建用户,但我不断收到此错误。

属性不符合架构:生日:数字不得超过 10 个字符(服务:AWSCognitoIdentityProviderService;状态代码:400;错误代码:InvalidParameterException;请求 ID:98f3de9e-5ce3-11e7-98e8-9d0c69d31df9)

用户池是使用无服务器通过以下方式创建的

Type: AWS::Cognito::UserPool
  DeletionPolicy: Retain
  Properties:
    UserPoolName: employees
    AdminCreateUserConfig:
      AllowAdminCreateUserOnly: true
    Policies:
      PasswordPolicy:
        MinimumLength: 8
        RequireLowercase: true
        RequireNumbers: true
    Schema:
      - Name: "picture"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "given_name"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "middle_name"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "family_name"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "address"
        AttributeDataType: String
        Mutable: true
        Required: false
      - Name: "birthdate"
        AttributeDataType: String
        Mutable: true
        Required: true
      - Name: "gender"
        AttributeDataType: String
        Mutable: true
        Required: true

【问题讨论】:

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


    【解决方案1】:

    一定很晚了,但试试下面的代码,我定义了 MinLength 和 MaxLength:

    Type: AWS::Cognito::UserPool
      DeletionPolicy: Retain
      Properties:
        UserPoolName: employees
        AdminCreateUserConfig:
          AllowAdminCreateUserOnly: true
        Policies:
          PasswordPolicy:
            MinimumLength: 8
            RequireLowercase: true
            RequireNumbers: true
        Schema:
          - Name: "picture"
            AttributeDataType: String
            Mutable: true
            Required: false
          - Name: "given_name"
            AttributeDataType: String
            Mutable: true
            Required: true
          - Name: "middle_name"
            AttributeDataType: String
            Mutable: true
            Required: false
          - Name: "family_name"
            AttributeDataType: String
            Mutable: true
            Required: true
          - Name: "address"
            AttributeDataType: String
            Mutable: true
            Required: false
          - Name: "birthdate"
            AttributeDataType: String
            Mutable: true
            Required: true
            DeveloperOnlyAttribute: false
            StringAttributeConstraints: 
              MinLength: "10"
              MaxLength: "10"
          - Name: "gender"
            AttributeDataType: String
            Mutable: true
            Required: true
    

    【讨论】:

      猜你喜欢
      • 2019-09-04
      • 1970-01-01
      • 2021-08-13
      • 2019-03-15
      • 2018-05-11
      • 2019-09-13
      • 2017-02-10
      • 2019-10-31
      • 2022-01-13
      相关资源
      最近更新 更多