Skip to content

CognitoIdentityProviderClient#

Index > CognitoIdentityProvider > CognitoIdentityProviderClient

Auto-generated documentation for CognitoIdentityProvider type annotations stubs module mypy-boto3-cognito-idp.

CognitoIdentityProviderClient#

Type annotations and code completion for boto3.client("cognito-idp"). boto3 documentation

# CognitoIdentityProviderClient usage example

from boto3.session import Session
from mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient

def get_cognito-idp_client() -> CognitoIdentityProviderClient:
    return Session().client("cognito-idp")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("cognito-idp").exceptions structure.

# Exceptions.exceptions usage example

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

try:
    do_something(client)
except (
    client.exceptions.AliasExistsException,
    client.exceptions.ClientError,
    client.exceptions.CodeDeliveryFailureException,
    client.exceptions.CodeMismatchException,
    client.exceptions.ConcurrentModificationException,
    client.exceptions.DuplicateProviderException,
    client.exceptions.EnableSoftwareTokenMFAException,
    client.exceptions.ExpiredCodeException,
    client.exceptions.ForbiddenException,
    client.exceptions.GroupExistsException,
    client.exceptions.InternalErrorException,
    client.exceptions.InvalidEmailRoleAccessPolicyException,
    client.exceptions.InvalidLambdaResponseException,
    client.exceptions.InvalidOAuthFlowException,
    client.exceptions.InvalidParameterException,
    client.exceptions.InvalidPasswordException,
    client.exceptions.InvalidSmsRoleAccessPolicyException,
    client.exceptions.InvalidSmsRoleTrustRelationshipException,
    client.exceptions.InvalidUserPoolConfigurationException,
    client.exceptions.LimitExceededException,
    client.exceptions.MFAMethodNotFoundException,
    client.exceptions.NotAuthorizedException,
    client.exceptions.PasswordResetRequiredException,
    client.exceptions.PreconditionNotMetException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ScopeDoesNotExistException,
    client.exceptions.SoftwareTokenMFANotFoundException,
    client.exceptions.TooManyFailedAttemptsException,
    client.exceptions.TooManyRequestsException,
    client.exceptions.UnauthorizedException,
    client.exceptions.UnexpectedLambdaException,
    client.exceptions.UnsupportedIdentityProviderException,
    client.exceptions.UnsupportedOperationException,
    client.exceptions.UnsupportedTokenTypeException,
    client.exceptions.UnsupportedUserStateException,
    client.exceptions.UserImportInProgressException,
    client.exceptions.UserLambdaValidationException,
    client.exceptions.UserNotConfirmedException,
    client.exceptions.UserNotFoundException,
    client.exceptions.UserPoolAddOnNotEnabledException,
    client.exceptions.UserPoolTaggingException,
    client.exceptions.UsernameExistsException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_cognito_idp.client import Exceptions

def handle_error(exc: Exceptions.AliasExistsException) -> None:
    ...

Methods#

add_custom_attributes#

Adds additional user attributes to the user pool schema.

Type annotations and code completion for boto3.client("cognito-idp").add_custom_attributes method. boto3 documentation

# add_custom_attributes method definition

def add_custom_attributes(
    self,
    *,
    UserPoolId: str,
    CustomAttributes: Sequence[SchemaAttributeTypeTypeDef],  # (1)
) -> Dict[str, Any]:
    ...
  1. See SchemaAttributeTypeTypeDef
# add_custom_attributes method usage example with argument unpacking

kwargs: AddCustomAttributesRequestRequestTypeDef = {  # (1)
    "UserPoolId": ...,
    "CustomAttributes": ...,
}

parent.add_custom_attributes(**kwargs)
  1. See AddCustomAttributesRequestRequestTypeDef

admin_add_user_to_group#

Adds a user to a group.

Type annotations and code completion for boto3.client("cognito-idp").admin_add_user_to_group method. boto3 documentation

# admin_add_user_to_group method definition

def admin_add_user_to_group(
    self,
    *,
    UserPoolId: str,
    Username: str,
    GroupName: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# admin_add_user_to_group method usage example with argument unpacking

kwargs: AdminAddUserToGroupRequestRequestTypeDef = {  # (1)
    "UserPoolId": ...,
    "Username": ...,
    "GroupName": ...,
}

parent.admin_add_user_to_group(**kwargs)
  1. See AdminAddUserToGroupRequestRequestTypeDef

admin_confirm_sign_up#

This IAM-authenticated API operation provides a code that Amazon Cognito sent to your user when they signed up in your user pool.

Type annotations and code completion for boto3.client("cognito-idp").admin_confirm_sign_up method. boto3 documentation

# admin_confirm_sign_up method definition

def admin_confirm_sign_up(
    self,
    *,
    UserPoolId: str,
    Username: str,
    ClientMetadata: Mapping[str, str] = ...,
) -> Dict[str, Any]:
    ...
# admin_confirm_sign_up method usage example with argument unpacking

kwargs: AdminConfirmSignUpRequestRequestTypeDef = {  # (1)
    "UserPoolId": ...,
    "Username": ...,
}

parent.admin_confirm_sign_up(**kwargs)
  1. See AdminConfirmSignUpRequestRequestTypeDef

admin_create_user#

Creates a new user in the specified user pool.

Type annotations and code completion for boto3.client("cognito-idp").admin_create_user method. boto3 documentation

# admin_create_user method definition

def admin_create_user(
    self,
    *,
    UserPoolId: str,
    Username: str,
    UserAttributes: Sequence[AttributeTypeTypeDef] = ...,  # (1)
    ValidationData: Sequence[AttributeTypeTypeDef] = ...,  # (1)
    TemporaryPassword: str = ...,
    ForceAliasCreation: bool = ...,
    MessageAction: MessageActionTypeType = ...,  # (3)
    DesiredDeliveryMediums: Sequence[DeliveryMediumTypeType] = ...,  # (4)
    ClientMetadata: Mapping[str, str] = ...,
) -> AdminCreateUserResponseTypeDef:  # (5)
    ...
  1. See AttributeTypeTypeDef
  2. See AttributeTypeTypeDef
  3. See MessageActionTypeType
  4. See DeliveryMediumTypeType
  5. See AdminCreateUserResponseTypeDef
# admin_create_user method usage example with argument unpacking

kwargs: AdminCreateUserRequestRequestTypeDef = {  # (1)
    "UserPoolId": ...,
    "Username": ...,
}

parent.admin_create_user(**kwargs)
  1. See AdminCreateUserRequestRequestTypeDef

admin_delete_user#

Deletes a user as an administrator.

Type annotations and code completion for boto3.client("cognito-idp").admin_delete_user method. boto3 documentation

# admin_delete_user method definition

def admin_delete_user(
    self,
    *,
    UserPoolId: str,
    Username: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# admin_delete_user method usage example with argument unpacking

kwargs: AdminDeleteUserRequestRequestTypeDef = {  # (1)
    "UserPoolId": ...,
    "Username": ...,
}

parent.admin_delete_user(**kwargs)
  1. See AdminDeleteUserRequestRequestTypeDef

admin_delete_user_attributes#

Deletes the user attributes in a user pool as an administrator.

Type annotations and code completion for boto3.client("cognito-idp").admin_delete_user_attributes method.