【问题标题】:Change AWS Cognitio "Enabled Identity Providers" via Python SDK通过 Python 开发工具包更改 AWS Cognitio “启用的身份提供商”
【发布时间】:2019-03-23 17:35:11
【问题描述】:

我想通过 Python 开发工具包更改一个设置,以保护 AWS Cognito。我可以通过“Cognito -> User Pools -> App Client Settings -> Cognito User Pool”更改 AWS Web 控制台中的设置(见图)

这是我的代码

client = boto3.client('cognito-idp')

client.update_user_pool_client(
    UserPoolId=USER_POOL_ID,
    ClientId=user_pool_client_id,
    SupportedIdentityProviders=[
        'CognitoUserPool'
    ]
)

我收到的错误是

An error occurred (InvalidParameterException) when calling the
UpdateUserPoolClient operation: The provider CognitoUserPool
does not exist for User Pool xxxxxx

目前还不清楚我应该为SupportedIdentityProviders 传递什么字符串值。我看到的唯一提示来自https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-idp-settings.html

--supported-identity-providers '["MySAMLIdP", "LoginWithAmazon"]'

我什至不能 100% 确定 SupportedIdentityProviders 是否与我要更改的设置有关,但在文档中找不到任何说明。

【问题讨论】:

    标签: amazon-web-services boto3 amazon-cognito


    【解决方案1】:

    要传递的正确值是COGNITO

    client.update_user_pool_client(
        UserPoolId=USER_POOL_ID,
        ClientId=user_pool_client_id,
        SupportedIdentityProviders=[
            'COGNITO'
        ]
    )
    

    我是通过查看其他人的 CloudFormation 自定义资源 https://github.com/rosberglinhares/CloudFormationCognitoCustomResources/blob/master/SampleInfrastructure.template.yaml#L105 的源代码才发现这一点的

    我无法从官方 AWS Docs/Boto3 文档中找到正确的解决方案。如果有人知道SupportedIdentityProviders 的可能值记录在哪里,请发表评论。

    【讨论】:

      猜你喜欢
      • 2019-03-13
      • 1970-01-01
      • 2015-08-08
      • 2020-04-25
      • 2018-10-08
      • 2017-10-14
      • 1970-01-01
      • 2016-09-12
      • 2016-12-04
      相关资源
      最近更新 更多