Skip to content

CognitoIdentityClient#

Index > CognitoIdentity > CognitoIdentityClient

Auto-generated documentation for CognitoIdentity type annotations stubs module mypy-boto3-cognito-identity.

CognitoIdentityClient#

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

# CognitoIdentityClient usage example

from boto3.session import Session
from mypy_boto3_cognito_identity.client import CognitoIdentityClient

def get_cognito-identity_client() -> CognitoIdentityClient:
    return Session().client("cognito-identity")

Exceptions#

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

# Exceptions.exceptions usage example

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

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.ConcurrentModificationException,
    client.exceptions.DeveloperUserAlreadyRegisteredException,
    client.exceptions.ExternalServiceException,
    client.exceptions.InternalErrorException,
    client.exceptions.InvalidIdentityPoolConfigurationException,
    client.exceptions.InvalidParameterException,
    client.exceptions.LimitExceededException,
    client.exceptions.NotAuthorizedException,
    client.exceptions.ResourceConflictException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.TooManyRequestsException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_cognito_identity.client import Exceptions

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

Methods#

can_paginate#

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

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

generate_presigned_url#

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

# generate_presigned_url method definition

def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

create_identity_pool#

Creates a new identity pool.

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

# create_identity_pool method definition

def create_identity_pool(
    self,
    *,
    IdentityPoolName: str,
    AllowUnauthenticatedIdentities: bool,
    AllowClassicFlow: bool = ...,
    SupportedLoginProviders: Mapping[str, str] = ...,
    DeveloperProviderName: str = ...,
    OpenIdConnectProviderARNs: Sequence[str] = ...,
    CognitoIdentityProviders: Sequence[CognitoIdentityProviderTypeDef] = ...,  # (1)
    SamlProviderARNs: Sequence[str] = ...,
    IdentityPoolTags: Mapping[str, str] = ...,
) -> IdentityPoolTypeDef:  # (2)
    ...
  1. See CognitoIdentityProviderTypeDef
  2. See IdentityPoolTypeDef
# create_identity_pool method usage example with argument unpacking

kwargs: CreateIdentityPoolInputRequestTypeDef = {  # (1)
    "IdentityPoolName": ...,
    "AllowUnauthenticatedIdentities": ...,
}

parent.create_identity_pool(**kwargs)
  1. See CreateIdentityPoolInputRequestTypeDef

delete_identities#

Deletes identities from an identity pool.

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

# delete_identities method definition

def delete_identities(
    self,
    *,
    IdentityIdsToDelete: Sequence[str],
) -> DeleteIdentitiesResponseTypeDef:  # (1)
    ...
  1. See DeleteIdentitiesResponseTypeDef
# delete_identities method usage example with argument unpacking

kwargs: DeleteIdentitiesInputRequestTypeDef = {  # (1)
    "IdentityIdsToDelete": ...,
}

parent.delete_identities(**kwargs)
  1. See DeleteIdentitiesInputRequestTypeDef

delete_identity_pool#

Deletes an identity pool.

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

# delete_identity_pool method definition

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

kwargs: DeleteIdentityPoolInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
}

parent.delete_identity_pool(**kwargs)
  1. See DeleteIdentityPoolInputRequestTypeDef

describe_identity#

Returns metadata related to the given identity, including when the identity was created and any associated linked logins.

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

# describe_identity method definition

def describe_identity(
    self,
    *,
    IdentityId: str,
) -> IdentityDescriptionResponseTypeDef:  # (1)
    ...
  1. See IdentityDescriptionResponseTypeDef
# describe_identity method usage example with argument unpacking

kwargs: DescribeIdentityInputRequestTypeDef = {  # (1)
    "IdentityId": ...,
}

parent.describe_identity(**kwargs)
  1. See DescribeIdentityInputRequestTypeDef

describe_identity_pool#

Gets details about a particular identity pool, including the pool name, ID description, creation date, and current number of users.

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

# describe_identity_pool method definition

def describe_identity_pool(
    self,
    *,
    IdentityPoolId: str,
) -> IdentityPoolTypeDef:  # (1)
    ...
  1. See IdentityPoolTypeDef
# describe_identity_pool method usage example with argument unpacking

kwargs: DescribeIdentityPoolInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
}

parent.describe_identity_pool(**kwargs)
  1. See DescribeIdentityPoolInputRequestTypeDef

get_credentials_for_identity#

Returns credentials for the provided identity ID.

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

# get_credentials_for_identity method definition

def get_credentials_for_identity(
    self,
    *,
    IdentityId: str,
    Logins: Mapping[str, str] = ...,
    CustomRoleArn: str = ...,
) -> GetCredentialsForIdentityResponseTypeDef:  # (1)
    ...
  1. See GetCredentialsForIdentityResponseTypeDef
# get_credentials_for_identity method usage example with argument unpacking

kwargs: GetCredentialsForIdentityInputRequestTypeDef = {  # (1)
    "IdentityId": ...,
}

parent.get_credentials_for_identity(**kwargs)
  1. See GetCredentialsForIdentityInputRequestTypeDef

get_id#

Generates (or retrieves) a Cognito ID.

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

# get_id method definition

def get_id(
    self,
    *,
    IdentityPoolId: str,
    AccountId: str = ...,
    Logins: Mapping[str, str] = ...,
) -> GetIdResponseTypeDef:  # (1)
    ...
  1. See GetIdResponseTypeDef
# get_id method usage example with argument unpacking

kwargs: GetIdInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
}

parent.get_id(**kwargs)
  1. See GetIdInputRequestTypeDef

get_identity_pool_roles#

Gets the roles for an identity pool.

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

# get_identity_pool_roles method definition

def get_identity_pool_roles(
    self,
    *,
    IdentityPoolId: str,
) -> GetIdentityPoolRolesResponseTypeDef:  # (1)
    ...
  1. See GetIdentityPoolRolesResponseTypeDef
# get_identity_pool_roles method usage example with argument unpacking

kwargs: GetIdentityPoolRolesInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
}

parent.get_identity_pool_roles(**kwargs)
  1. See GetIdentityPoolRolesInputRequestTypeDef

get_open_id_token#

Gets an OpenID token, using a known Cognito ID.

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

# get_open_id_token method definition

def get_open_id_token(
    self,
    *,
    IdentityId: str,
    Logins: Mapping[str, str] = ...,
) -> GetOpenIdTokenResponseTypeDef:  # (1)
    ...
  1. See GetOpenIdTokenResponseTypeDef
# get_open_id_token method usage example with argument unpacking

kwargs: GetOpenIdTokenInputRequestTypeDef = {  # (1)
    "IdentityId": ...,
}

parent.get_open_id_token(**kwargs)
  1. See GetOpenIdTokenInputRequestTypeDef

get_open_id_token_for_developer_identity#

Registers (or retrieves) a Cognito IdentityId and an OpenID Connect token for a user authenticated by your backend authentication process.

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

# get_open_id_token_for_developer_identity method definition

def get_open_id_token_for_developer_identity(
    self,
    *,
    IdentityPoolId: str,
    Logins: Mapping[str, str],
    IdentityId: str = ...,
    PrincipalTags: Mapping[str, str] = ...,
    TokenDuration: int = ...,
) -> GetOpenIdTokenForDeveloperIdentityResponseTypeDef:  # (1)
    ...
  1. See GetOpenIdTokenForDeveloperIdentityResponseTypeDef
# get_open_id_token_for_developer_identity method usage example with argument unpacking

kwargs: GetOpenIdTokenForDeveloperIdentityInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
    "Logins": ...,
}

parent.get_open_id_token_for_developer_identity(**kwargs)
  1. See GetOpenIdTokenForDeveloperIdentityInputRequestTypeDef

get_principal_tag_attribute_map#

Use GetPrincipalTagAttributeMap to list all mappings between PrincipalTags and user attributes.

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

# get_principal_tag_attribute_map method definition

def get_principal_tag_attribute_map(
    self,
    *,
    IdentityPoolId: str,
    IdentityProviderName: str,
) -> GetPrincipalTagAttributeMapResponseTypeDef:  # (1)
    ...
  1. See GetPrincipalTagAttributeMapResponseTypeDef
# get_principal_tag_attribute_map method usage example with argument unpacking

kwargs: GetPrincipalTagAttributeMapInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
    "IdentityProviderName": ...,
}

parent.get_principal_tag_attribute_map(**kwargs)
  1. See GetPrincipalTagAttributeMapInputRequestTypeDef

list_identities#

Lists the identities in an identity pool.

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

# list_identities method definition

def list_identities(
    self,
    *,
    IdentityPoolId: str,
    MaxResults: int,
    NextToken: str = ...,
    HideDisabled: bool = ...,
) -> ListIdentitiesResponseTypeDef:  # (1)
    ...
  1. See ListIdentitiesResponseTypeDef
# list_identities method usage example with argument unpacking

kwargs: ListIdentitiesInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
    "MaxResults": ...,
}

parent.list_identities(**kwargs)
  1. See ListIdentitiesInputRequestTypeDef

list_identity_pools#

Lists all of the Cognito identity pools registered for your account.

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

# list_identity_pools method definition

def list_identity_pools(
    self,
    *,
    MaxResults: int,
    NextToken: str = ...,
) -> ListIdentityPoolsResponseTypeDef:  # (1)
    ...
  1. See ListIdentityPoolsResponseTypeDef
# list_identity_pools method usage example with argument unpacking

kwargs: ListIdentityPoolsInputRequestTypeDef = {  # (1)
    "MaxResults": ...,
}

parent.list_identity_pools(**kwargs)
  1. See ListIdentityPoolsInputRequestTypeDef

list_tags_for_resource#

Lists the tags that are assigned to an Amazon Cognito identity pool.

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

# list_tags_for_resource method definition

def list_tags_for_resource(
    self,
    *,
    ResourceArn: str,
) -> ListTagsForResourceResponseTypeDef:  # (1)
    ...
  1. See ListTagsForResourceResponseTypeDef
# list_tags_for_resource method usage example with argument unpacking

kwargs: ListTagsForResourceInputRequestTypeDef = {  # (1)
    "ResourceArn": ...,
}

parent.list_tags_for_resource(**kwargs)
  1. See ListTagsForResourceInputRequestTypeDef

lookup_developer_identity#

Retrieves the IdentityID associated with a DeveloperUserIdentifier or the list of DeveloperUserIdentifier values associated with an IdentityId for an existing identity.

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

# lookup_developer_identity method definition

def lookup_developer_identity(
    self,
    *,
    IdentityPoolId: str,
    IdentityId: str = ...,
    DeveloperUserIdentifier: str = ...,
    MaxResults: int = ...,
    NextToken: str = ...,
) -> LookupDeveloperIdentityResponseTypeDef:  # (1)
    ...
  1. See LookupDeveloperIdentityResponseTypeDef
# lookup_developer_identity method usage example with argument unpacking

kwargs: LookupDeveloperIdentityInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
}

parent.lookup_developer_identity(**kwargs)
  1. See LookupDeveloperIdentityInputRequestTypeDef

merge_developer_identities#

Merges two users having different IdentityIds, existing in the same identity pool, and identified by the same developer provider.

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

# merge_developer_identities method definition

def merge_developer_identities(
    self,
    *,
    SourceUserIdentifier: str,
    DestinationUserIdentifier: str,
    DeveloperProviderName: str,
    IdentityPoolId: str,
) -> MergeDeveloperIdentitiesResponseTypeDef:  # (1)
    ...
  1. See MergeDeveloperIdentitiesResponseTypeDef
# merge_developer_identities method usage example with argument unpacking

kwargs: MergeDeveloperIdentitiesInputRequestTypeDef = {  # (1)
    "SourceUserIdentifier": ...,
    "DestinationUserIdentifier": ...,
    "DeveloperProviderName": ...,
    "IdentityPoolId": ...,
}

parent.merge_developer_identities(**kwargs)
  1. See MergeDeveloperIdentitiesInputRequestTypeDef

set_identity_pool_roles#

Sets the roles for an identity pool.

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

# set_identity_pool_roles method definition

def set_identity_pool_roles(
    self,
    *,
    IdentityPoolId: str,
    Roles: Mapping[str, str],
    RoleMappings: Mapping[str, RoleMappingUnionTypeDef] = ...,  # (1)
) -> EmptyResponseMetadataTypeDef:  # (2)
    ...
  1. See RoleMappingTypeDef RoleMappingOutputTypeDef
  2. See EmptyResponseMetadataTypeDef
# set_identity_pool_roles method usage example with argument unpacking

kwargs: SetIdentityPoolRolesInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
    "Roles": ...,
}

parent.set_identity_pool_roles(**kwargs)
  1. See SetIdentityPoolRolesInputRequestTypeDef

set_principal_tag_attribute_map#

You can use this operation to use default (username and clientID) attribute or custom attribute mappings.

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

# set_principal_tag_attribute_map method definition

def set_principal_tag_attribute_map(
    self,
    *,
    IdentityPoolId: str,
    IdentityProviderName: str,
    UseDefaults: bool = ...,
    PrincipalTags: Mapping[str, str] = ...,
) -> SetPrincipalTagAttributeMapResponseTypeDef:  # (1)
    ...
  1. See SetPrincipalTagAttributeMapResponseTypeDef
# set_principal_tag_attribute_map method usage example with argument unpacking

kwargs: SetPrincipalTagAttributeMapInputRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
    "IdentityProviderName": ...,
}

parent.set_principal_tag_attribute_map(**kwargs)
  1. See SetPrincipalTagAttributeMapInputRequestTypeDef

tag_resource#

Assigns a set of tags to the specified Amazon Cognito identity pool.

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

# tag_resource method definition

def tag_resource(
    self,
    *,
    ResourceArn: str,
    Tags: Mapping[str, str],
) -> dict[str, Any]:
    ...
# tag_resource method usage example with argument unpacking

kwargs: TagResourceInputRequestTypeDef = {  # (1)
    "ResourceArn": ...,
    "Tags": ...,
}

parent.tag_resource(**kwargs)
  1. See TagResourceInputRequestTypeDef

Unlinks a DeveloperUserIdentifier from an existing identity.

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

# unlink_developer_identity method definition

def unlink_developer_identity(
    self,
    *,
    IdentityId: str,
    IdentityPoolId: str,
    DeveloperProviderName: str,
    DeveloperUserIdentifier: str,
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# unlink_developer_identity method usage example with argument unpacking

kwargs: UnlinkDeveloperIdentityInputRequestTypeDef = {  # (1)
    "IdentityId": ...,
    "IdentityPoolId": ...,
    "DeveloperProviderName": ...,
    "DeveloperUserIdentifier": ...,
}

parent.unlink_developer_identity(**kwargs)
  1. See UnlinkDeveloperIdentityInputRequestTypeDef

Unlinks a federated identity from an existing account.

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

# unlink_identity method definition

def unlink_identity(
    self,
    *,
    IdentityId: str,
    Logins: Mapping[str, str],
    LoginsToRemove: Sequence[str],
) -> EmptyResponseMetadataTypeDef:  # (1)
    ...
  1. See EmptyResponseMetadataTypeDef
# unlink_identity method usage example with argument unpacking

kwargs: UnlinkIdentityInputRequestTypeDef = {  # (1)
    "IdentityId": ...,
    "Logins": ...,
    "LoginsToRemove": ...,
}

parent.unlink_identity(**kwargs)
  1. See UnlinkIdentityInputRequestTypeDef

untag_resource#

Removes the specified tags from the specified Amazon Cognito identity pool.

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

# untag_resource method definition

def untag_resource(
    self,
    *,
    ResourceArn: str,
    TagKeys: Sequence[str],
) -> dict[str, Any]:
    ...
# untag_resource method usage example with argument unpacking

kwargs: UntagResourceInputRequestTypeDef = {  # (1)
    "ResourceArn": ...,
    "TagKeys": ...,
}

parent.untag_resource(**kwargs)
  1. See UntagResourceInputRequestTypeDef

update_identity_pool#

Updates an identity pool.

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

# update_identity_pool method definition

def update_identity_pool(
    self,
    *,
    IdentityPoolId: str,
    IdentityPoolName: str,
    AllowUnauthenticatedIdentities: bool,
    AllowClassicFlow: bool = ...,
    SupportedLoginProviders: Mapping[str, str] = ...,
    DeveloperProviderName: str = ...,
    OpenIdConnectProviderARNs: Sequence[str] = ...,
    CognitoIdentityProviders: Sequence[CognitoIdentityProviderTypeDef] = ...,  # (1)
    SamlProviderARNs: Sequence[str] = ...,
    IdentityPoolTags: Mapping[str, str] = ...,
) -> IdentityPoolTypeDef:  # (2)
    ...
  1. See CognitoIdentityProviderTypeDef
  2. See IdentityPoolTypeDef
# update_identity_pool method usage example with argument unpacking

kwargs: IdentityPoolRequestTypeDef = {  # (1)
    "IdentityPoolId": ...,
    "IdentityPoolName": ...,
    "AllowUnauthenticatedIdentities": ...,
}

parent.update_identity_pool(**kwargs)
  1. See IdentityPoolRequestTypeDef

get_paginator#

Type annotations and code completion for boto3.client("cognito-identity").get_paginator method with overloads.