如何在 AWS SAM 或 Cloudformation 中添加身份提供商

问题描述

我正在尝试在我的 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:
        ...

解决方法

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