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 the specified user to the specified 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#

Confirms user registration as an admin without using a confirmation code.

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. boto3 documentation

# admin_delete_user_attributes method definition

def admin_delete_user_attributes(
    self,
    *,
    UserPoolId: str,
    Username: str,
    UserAttributeNames: Sequence[str],
) -> Dict[str, Any]:
    ...
# admin_delete_user_attributes method usage example with argument unpacking

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

parent.admin_delete_user_attributes(**kwargs)
  1. See AdminDeleteUserAttributesRequestRequestTypeDef

admin_disable_provider_for_user#

Prevents the user from signing in with the specified external (SAML or social) identity provider (IdP).

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

# admin_disable_provider_for_user method definition

def admin_disable_provider_for_user(
    self,
    *,
    UserPoolId: str,
    User: ProviderUserIdentifierTypeTypeDef,  # (1)
) -> Dict[str, Any]:
    ...
  1. See ProviderUserIdentifierTypeTypeDef
# admin_disable_provider_for_user method usage example with argument unpacking

kwargs: AdminDisableProviderForUserRequestRequestTypeDef = {  # (1)
    "UserPoolId": ...,
    "User": ...,
}

parent.admin_disable_provider_for_user(**kwargs)
  1. See AdminDisableProviderForUserRequestRequestTypeDef

admin_disable_user#

Deactivates a user and revokes all access tokens for the user.

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

# admin_disable_user method definition

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

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

parent.admin_disable_user(**kwargs)
  1. See AdminDisableUserRequestRequestTypeDef

admin_enable_user#

Enables the specified user as an administrator.

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

# admin_enable_user method definition

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

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

parent.admin_enable_user(**kwargs)
  1. See AdminEnableUserRequestRequestTypeDef

admin_forget_device#

Forgets the device, as an administrator.

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

# admin_forget_device method definition

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

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

parent.admin_forget_device(**kwargs)
  1. See AdminForgetDeviceRequestRequestTypeDef

admin_get_device#

Gets the device, as an administrator.

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

# admin_get_device method definition

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

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

parent.admin_get_device(**kwargs)
  1. See AdminGetDeviceRequestRequestTypeDef

admin_get_user#

Gets the specified user by user name in a user pool as an administrator.

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

# admin_get_user method definition

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

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

parent.admin_get_user(**kwargs)
  1. See AdminGetUserRequestRequestTypeDef

admin_initiate_auth#

Initiates the authentication flow, as an administrator.

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

# admin_initiate_auth method definition

def admin_initiate_auth(
    self,
    *,
    UserPoolId: str,
    ClientId: str,
    AuthFlow: AuthFlowTypeType,  # (1)
    AuthParameters: Mapping[str, str] = ...,
    ClientMetadata: Mapping[str, str] = ...,
    AnalyticsMetadata: AnalyticsMetadataTypeTypeDef = ...,  # (2)
    ContextData: ContextDataTypeTypeDef = ...,  # (3)
) -> AdminInitiateAuthResponseTypeDef:  # (4)
    ...
  1. See AuthFlowTypeType
  2. See AnalyticsMetadataTypeTypeDef
  3. See ContextDataTypeTypeDef
  4. See AdminInitiateAuthResponseTypeDef
# admin_initiate_auth method usage example with argument unpacking

kwargs: AdminInitiateAuthRequestRequestTypeDef = {  # (1)
    "UserPoolId": ...,
    "ClientId": ...,
    "AuthFlow": ...,
}

parent.admin_initiate_auth(**kwargs)
  1. See AdminInitiateAuthRequestRequestTypeDef

Links an existing user account in a user pool ( DestinationUser) to an identity from an external IdP ( SourceUser) based on a specified attribute name and value from the external IdP.

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

# admin_link_provider_for_user method definition

def admin_link_provider_for_user(
    self,
    *,
    UserPoolId: str,
    DestinationUser: ProviderUserIdentifierTypeTypeDef,  # (1)
    SourceUser: ProviderUserIdentifierTypeTypeDef,  # (1)
) -> Dict[str, Any]:
    ...
  1. See ProviderUserIdentifierTypeTypeDef
  2. See