当前位置: 首页 > 知识库问答 >
问题:

AWSCognito标识符提供者;状态代码: 400;错误代码: InvalidParameter异常: Cognito无效属性DataType

穆正祥
2023-03-14

我喜欢通过基于Java的AWS-CDK版本0.24.1创建cognito用户池。在cdk部署期间我收到了InvalidParameterException错误。

服务:AWSCognitoIdentityProvider
状态代码:400
错误代码:ValueDealPosialExtExc:Qualito无效属性DATABATYPE输入,考虑使用提供的属性数据类型枚举

    CfnUserPool userPool = new CfnUserPool(this, "cognito",
    CfnUserPoolProps.builder()
        .withAdminCreateUserConfig(
            AdminCreateUserConfigProperty.builder()
                .withAllowAdminCreateUserOnly(false)
                .build())
        .withPolicies(
            PoliciesProperty.builder()
                .withPasswordPolicy(
                    PasswordPolicyProperty.builder()
                        .withMinimumLength(6)
                        .withRequireLowercase(false)
                        .withRequireNumbers(false)
                        .withRequireSymbols(false)
                        .withRequireUppercase(false)
                        .build()
                )
                .build()
        )
        .withAutoVerifiedAttributes(Arrays.asList("email"))
        .withSchema(Arrays.asList("email"))
    .build());

可能使用自动验证属性(Arrays.asList(“email”)或的简单字符串列表。使用模式(Arrays.asList(“email”)是错误的。但不幸的是,只有在方法签名中声明的对象列表,没有具体类型:public CfnUserPoolProps.Builder和autoverifiedattributes(@Nullable list value)

是否有一个示例Snippete使用基于Java的aws cdk创建类似的用户池。


共有1个答案

赵英范
2023-03-14

使用CfnUserPool.SchemaAttributeProperty.builder()解决了该问题。我认为SchemaAttributeProperty是方法withSchema(@Nullable List)的预期数据类型

CfnUserPool userPool = new CfnUserPool(this, "cognito",
    CfnUserPoolProps.builder()
        .withAdminCreateUserConfig(
            AdminCreateUserConfigProperty.builder()
                .withAllowAdminCreateUserOnly(false)
                .build())
        .withPolicies(
            PoliciesProperty.builder()
                .withPasswordPolicy(
                    PasswordPolicyProperty.builder()
                        .withMinimumLength(6)
                        .withRequireLowercase(false)
                        .withRequireNumbers(false)
                        .withRequireSymbols(false)
                        .withRequireUppercase(false)
                        .build()
                )
                .build()
        )
       .withAutoVerifiedAttributes(Arrays.asList("email"))
       .withSchema(Arrays.asList(
           CfnUserPool.SchemaAttributeProperty.builder()
               .withAttributeDataType("String")
               .withName("email")
               .withRequired(true)
           .build()))
    .build());

 类似资料:
  • 代码- 即使db实例存在,它也会为某些调用抛出错误。错误详细信息- 你能告诉我我在这里缺了什么吗? 错误含义-

  • 使用Alamofire 4/Swift 3,您如何区分由于以下原因而失败的请求: 网络连接(主机关闭,无法连接到主机)vs 代码: 我们希望以不同的方式处理每个案件。在后一种情况下,我们要询问回答。(在前一种情况下,我们不知道,因为没有回应)。

  • 我得到一个AWS错误代码:SignatureDoesNotMatch,状态代码:403时,试图通过亚马逊SES发送邮件。 我已经确认我正在使用通过https://console.aws.amazon.com/iam/home?#users创建的正确凭据,错误仍然存在。 我假设我在iam/home上创建的凭据实际上是全局的,但我不知道我进一步做错了什么。整个错误是: AWS错误代码:Signatur

  • 问题内容: 我在Azure中托管了一个非常简单的.NET Web API,它有两种非常简单的方法: 我创建了一个简单的插件来调用这些方法。在我的AngularJS代码中,我进行了两个非常简单的$ http调用。GET工作正常。但是,POST始终返回“ 400(错误请求)”,然后在WebStorm控制台中不久显示“ XMLHttpRequestion无法加载…无效的HTTP状态代码400”。 任何和

  • 我正在为一个Spring-Boot应用程序编写组件测试,以测试我的安全配置。因此,我正在运行测试,应该测试成功的响应以及“禁止”状态。我遇到的问题是,由于我的REST调用需要一个复杂的JSON,对于阻塞的调用,测试会失败,因为TestRestTemplate试图反序列化不存在的响应体。 我正在运行一个Spring-Boot应用程序,tests类的注释如下: 我试图测试一个应该返回用户列表的REST

  • 我有问题在Google+OAuth使用龙卷风框架。我在nginx服务器上使用AngularJS作为前端,python tornado作为后端。我从AngularJS向Google+API发送HTTP请求,我的tornado API重定向到Google登录。成功登录后,它重定向回到我的应用程序。在重定向的时候,我认为它会自动刷新,即有两个来自谷歌的重定向调用。 查看tornado OAuth2中的两