【问题标题】:Setting custom attributes in AWS Cognito在 AWS Cognito 中设置自定义属性
【发布时间】:2020-05-27 14:34:37
【问题描述】:

我在 aws cognito 中使用 google 作为联合身份。

我已经创建了用户,但我无法添加自定义属性,我在用户池中有。我正在尝试使用控制台添加自定义属性。

当我点击User and Groups 时,我没有看到这个自定义属性 -> 任何用户。

我也尝试使用 cognito 池作为 Idp(与 Google 一起),但这也没有改变任何东西。

我也试过用这个来创建用户:

aws cognito-idp admin-create-user \
    --profile stage \
    --region ap-south-1 \
    --user-pool-id SSO-Test-User-Pool \
    --username test@test.com \
    --user-attributes Name=email,Value=test@test.com Name=custom:custom:role,Value="cms.tv_admin" \
    --message-action SUPPRESS

但它给出了错误:

An error occurred (InvalidParameterException) when calling the AdminCreateUser operation: 1 validation error detected: Value 'SSO-Test-User-Pool' at 'userPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+_[0-9a-zA-Z]+

当我尝试使用此更新属性时也是如此:

aws cognito-idp admin-update-user-attributes \
    --profile stage \
    --region ap-south-1 \
    --user-pool-id SSO-Test-User-Pool \
    --username Google_113423776936123400493 \
    --user-attributes Name=custom:custom:role,Value=admin

此外,我发现这些命令可以使用应用程序运行,并且他们需要在登录后返回代码,我想他们会使用重定向 URI 来获取代码。

如何在 CLI 中使用它?

我在App Client Settings 中的应用程序的自定义属性上设置了可读和可写属性。

谢谢。

如果需要更多信息,请告诉我。

custom attribute

User Property Page

app client settings

app client settings - readable/writable permissions

【问题讨论】:

    标签: amazon-web-services amazon-cognito


    【解决方案1】:

    这是您的联合池名称,而不是联合池 ID。

    您可以通过以下方法获取您的联合池 ID:

    从控制台选择您的身份池,在页面顶部上方的Pool ARN 将是Pool Id。它将以创建池的区域为前缀。

    或者运行list-identity-pools,然后从Id 属性中复制值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-19
      • 2020-02-06
      • 2017-09-08
      • 2020-07-08
      • 2021-04-25
      • 2018-07-19
      • 2018-03-25
      • 2018-03-03
      相关资源
      最近更新 更多