【问题标题】:AWS Cognito with CloudFormation - InvalidParameterException on schema sttributes带有 CloudFormation 的 AWS Cognito - 架构属性上的 InvalidParameterException
【发布时间】:2021-01-31 22:21:23
【问题描述】:

我正在尝试使用 CloudFormation 创建 Cognito 用户池,但在创建时不断收到以下错误:

Required custom attributes are not supported currently. (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: d21bec3f-adca-4c38-a91a-fa59f16a2cdc; Proxy: null)

错误消息说我正在尝试创建自定义属性,但我只是尝试为标准属性指定行为,例如emailusernamepreferred_username

AWS 文档在这里没有多大帮助。有什么线索吗? 请参阅下面的我的 CF 代码:

  CognitoUserPool:
    Type: AWS::Cognito::UserPool
    Properties: 
      AccountRecoverySetting: # Defines which verified available method a user can use to recover their password when they call ForgotPassword
         RecoveryMechanisms:
          - Name: "verified_email"
            Priority: 1
      AdminCreateUserConfig: 
        AllowAdminCreateUserOnly: False
      Policies: 
        PasswordPolicy: 
          MinimumLength: 6
          RequireLowercase: False
          RequireNumbers: False
          RequireSymbols: False
          RequireUppercase: False
          TemporaryPasswordValidityDays: 7
      Schema: 
        - AttributeDataType: "String"
          Mutable: False
          Name: "email"
          Required: True
        - AttributeDataType: "String"
          Mutable: False
          Name: "username"
          Required: True
        - AttributeDataType: "String"
          Mutable: True
          Name: "preferred_username"
          Required: True
      UsernameAttributes: # This user pool property cannot be updated
        - "email"
      UserPoolName: !Sub "${ProjectName}-userPool-${BranchName}"

感谢您的帮助, 乔尔

【问题讨论】:

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


    【解决方案1】:

    所以...在仔细阅读所有内容后,我意识到username 是一种奇怪的属性,因为它不是文档(here)上标准属性列表的一部分,但它总是需要的,如文档中所述:

    用户名值是一个单独的属性,与名称属性不同。用户名是注册用户的必填项,用户创建后不能更改。

    所以我从模式中取出该属性,认为无论如何它都会存在并且我可能无法更改它的属性。之后,它就可以正常工作了。

    【讨论】:

      猜你喜欢
      • 2018-03-03
      • 2021-05-31
      • 1970-01-01
      • 2018-09-13
      • 2019-04-07
      • 1970-01-01
      • 2018-08-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多