View a markdown version of this page

DescribeUserPoolClient搭配使用 Amazon SDK 或 CLI - Amazon Cognito
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DescribeUserPoolClient搭配使用 Amazon SDK 或 CLI

以下代码示例显示了如何使用DescribeUserPoolClient。

操作示例是大型程序的代码摘录,必须在上下文中运行。您可以在以下代码示例中查看此操作的上下文:

CLI
Amazon CLI

描述用户池客户端

此示例描述一个用户池客户端。

命令:

aws cognito-idp describe-user-pool-client --user-pool-id us-west-2_aaaaaaaaa --client-id 38fjsnc484p94kpqsnet7mpld0

输出:

{ "UserPoolClient": { "UserPoolId": "us-west-2_aaaaaaaaa", "ClientName": "MyApp", "ClientId": "38fjsnc484p94kpqsnet7mpld0", "ClientSecret": "CLIENT_SECRET", "LastModifiedDate": 1548108676.163, "CreationDate": 1548108676.163, "RefreshTokenValidity": 30, "ReadAttributes": [ "address", "birthdate", "custom:CustomAttr1", "custom:CustomAttr2", "email", "email_verified", "family_name", "gender", "given_name", "locale", "middle_name", "name", "nickname", "phone_number", "phone_number_verified", "picture", "preferred_username", "profile", "updated_at", "website", "zoneinfo" ], "WriteAttributes": [ "address", "birthdate", "custom:CustomAttr1", "custom:CustomAttr2", "email", "family_name", "gender", "given_name", "locale", "middle_name", "name", "nickname", "phone_number", "picture", "preferred_username", "profile", "updated_at", "website", "zoneinfo" ], "ExplicitAuthFlows": [ "ADMIN_NO_SRP_AUTH", "USER_PASSWORD_AUTH" ], "AllowedOAuthFlowsUserPoolClient": false } }
Python
适用于 Python 的 SDK(Boto3)
注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

def describe_user_pool_client( self, user_pool_id: str, client_id: str ) -> dict[str, Any]: """ Describes an app client in a user pool, including the client secret. :param user_pool_id: The ID of the user pool that contains the app client. :param client_id: The ID of the app client to describe. :return: A dictionary with the app client configuration. """ try: response = self.cognito_idp_client.describe_user_pool_client( UserPoolId=user_pool_id, ClientId=client_id ) client_info = response.get("UserPoolClient", dict()) logger.info( "Described app client %s in user pool %s.", client_id, user_pool_id, ) return client_info except ClientError as err: if err.response["Error"]["Code"] == "ResourceNotFoundException": logger.error( "The user pool %s or client %s does not exist. " "Verify the stack deployed successfully and the outputs are correct.", user_pool_id, client_id, ) raise
  • 有关 API 的详细信息,请参阅适用DescribeUserPoolClient于 Python 的Amazon SDK (Boto3) API 参考。

有关 S Amazon DK 开发者指南和代码示例的完整列表,请参阅将此服务与 Amazon SDK。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。