Skip to content

merge_developer_identities

merge_developer_identities(
    source_user_identifier: DeveloperUserIdentifier,
    destination_user_identifier: DeveloperUserIdentifier,
    developer_provider_name: DeveloperProviderName,
    identity_pool_id: IdentityPoolId,
    *,
    config_overrides: Optional[CognitoIdentityClientConfig] = None,
) -> MergeDeveloperIdentitiesResponse

Merges two users having different IdentityIds, existing in the same identity pool, and identified by the same developer provider. You can use this action to request that discrete users be merged and identified as a single user in the Cognito environment. Cognito associates the given source user (SourceUserIdentifier) with the IdentityId of the DestinationUserIdentifier. Only developer-authenticated users can be merged. If the users to be merged are associated with the same public provider, but as two different users, an exception will be thrown.

The number of linked logins is limited to 20. So, the number of linked logins for the source user, SourceUserIdentifier, and the destination user, DestinationUserIdentifier, together should not be larger than 20. Otherwise, an exception will be thrown.

You must use Amazon Web Services developer credentials to call this operation.

Parameters:

  • source_user_identifier (DeveloperUserIdentifier) –

    User identifier for the source user. The value should be a DeveloperUserIdentifier.

  • destination_user_identifier (DeveloperUserIdentifier) –

    User identifier for the destination user. The value should be a DeveloperUserIdentifier.

  • developer_provider_name (DeveloperProviderName) –

    The "domain" by which Cognito will refer to your users. This is a (pseudo) domain name that you provide while creating an identity pool. This name acts as a placeholder that allows your backend and the Cognito service to communicate about the developer provider. For the DeveloperProviderName, you can use letters as well as period (.), underscore (_), and dash (-).

  • identity_pool_id (IdentityPoolId) –

    An identity pool ID in the format REGION:GUID.

Raises:

Source code in docs_src/capo_cognito_identity/_services/cognito_identity.py
def merge_developer_identities(
    self,
    source_user_identifier: "capo_cognito_identity.types.developer_user_identifier.DeveloperUserIdentifier",
    destination_user_identifier: "capo_cognito_identity.types.developer_user_identifier.DeveloperUserIdentifier",
    developer_provider_name: "capo_cognito_identity.types.developer_provider_name.DeveloperProviderName",
    identity_pool_id: "capo_cognito_identity.types.identity_pool_id.IdentityPoolId",
    *,
    config_overrides: Optional[CognitoIdentityClientConfig] = None,
) -> "capo_cognito_identity.types.merge_developer_identities_response.MergeDeveloperIdentitiesResponse":
    """<p>Merges two users having different <code>IdentityId</code>s, existing in the same identity pool, and identified by the same developer provider. You can use this action to request that discrete users be merged and identified as a single user in the Cognito environment. Cognito associates the given source user (<code>SourceUserIdentifier</code>) with the <code>IdentityId</code> of the <code>DestinationUserIdentifier</code>. Only developer-authenticated users can be merged. If the users to be merged are associated with the same public provider, but as two different users, an exception will be thrown.</p> <p>The number of linked logins is limited to 20. So, the number of linked logins for the source user, <code>SourceUserIdentifier</code>, and the destination user, <code>DestinationUserIdentifier</code>, together should not be larger than 20. Otherwise, an exception will be thrown.</p> <p>You must use Amazon Web Services developer credentials to call this operation.</p>

    Args:
        source_user_identifier: <p>User identifier for the source user. The value should be a <code>DeveloperUserIdentifier</code>.</p>
        destination_user_identifier: <p>User identifier for the destination user. The value should be a <code>DeveloperUserIdentifier</code>.</p>
        developer_provider_name: <p>The "domain" by which Cognito will refer to your users. This is a (pseudo) domain name that you provide while creating an identity pool. This name acts as a placeholder that allows your backend and the Cognito service to communicate about the developer provider. For the <code>DeveloperProviderName</code>, you can use letters as well as period (.), underscore (_), and dash (-).</p>
        identity_pool_id: <p>An identity pool ID in the format REGION:GUID.</p>

    Raises:
        capo_cognito_identity.errors.internal_error_exception.InternalErrorException: <p>Thrown when the service encounters an error during processing the request.</p>
        capo_cognito_identity.errors.invalid_parameter_exception.InvalidParameterException: <p>Thrown for missing or bad input parameter(s).</p>
        capo_cognito_identity.errors.not_authorized_exception.NotAuthorizedException: <p>Thrown when a user is not authorized to access the requested resource.</p>
        capo_cognito_identity.errors.resource_conflict_exception.ResourceConflictException: <p>Thrown when a user tries to use a login which is already linked to another account.</p>
        capo_cognito_identity.errors.resource_not_found_exception.ResourceNotFoundException: <p>Thrown when the requested resource (for example, a dataset or record) does not exist.</p>
        capo_cognito_identity.errors.too_many_requests_exception.TooManyRequestsException: <p>Thrown when a request is throttled.</p>
        capo_cognito_identity.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cognito_identity.types.merge_developer_identities_input.MergeDeveloperIdentitiesInput]",
    ) -> OperationResponse[
        "capo_cognito_identity.types.merge_developer_identities_response.MergeDeveloperIdentitiesResponse"
    ]:
        import capo_cognito_identity._operations.aws_cognito_identity_service.merge_developer_identities

        output, http_response = (
            capo_cognito_identity._operations.aws_cognito_identity_service.merge_developer_identities.merge_developer_identities(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("MergeDeveloperIdentities")
    )
    input_: capo_cognito_identity.types.merge_developer_identities_input.MergeDeveloperIdentitiesInput = {
        "source_user_identifier": source_user_identifier,
        "destination_user_identifier": destination_user_identifier,
        "developer_provider_name": developer_provider_name,
        "identity_pool_id": identity_pool_id,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output