【问题标题】:How to add Identity Provider in AWS SAM or Cloudformation如何在 AWS SAM 或 Cloudformation 中添加身份提供者
【发布时间】:2021-07-26 07:46:18
【问题描述】:

我正在尝试在我的 SAM 应用程序中添加像 here 所述的身份提供者。

当我运行 sam deploy 时,我收到以下错误:

The attribute mapping is missing required attributes [nickname] (Service: AWSCognitoIdentityProviderService; Status Code: 400; Error Code: InvalidParameterException; Request ID: xy; Proxy: null)  

虽然在我的 YAML 定义中,我将属性 nickname 映射如下:

UserPoolIdentityProvider:
    Type: AWS::Cognito::UserPoolIdentityProvider
    Properties: 
      AttributeMapping:
        given_name: "nickname"
        sub: "username"
        email: "email"
      ProviderDetails:
        ...

【问题讨论】:

  • 您的用户池是否需要昵称?当您进行映射时,请检查您的用户池需要什么以及您的提供者字段是什么。
  • 是的,昵称是我的用户池中的必需属性。我检查了提供商的属性。在使用 aws 控制台之前,我实际上测试了整个事情。在那里,我也将 given_name 映射到了昵称并且它起作用了。

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


【解决方案1】:

检查提供者是否具有“昵称”属性以及池是否支持。

【讨论】:

  • 否,提供者没有“昵称”作为属性。那是我要映射到的 aws 属性。所以我才意识到我混淆了映射中的键和值。我应该反过来。所以这里指定映射的正确方式是:昵称:“given_name”。刚刚试了一下,效果很好。
猜你喜欢
  • 2017-11-10
  • 2020-04-25
  • 2019-03-04
  • 2022-07-28
  • 1970-01-01
  • 2017-01-05
  • 1970-01-01
  • 2020-07-06
  • 1970-01-01
相关资源
最近更新 更多