Skip to content

unlink_identity

unlink_identity(
    identity_id: IdentityId,
    logins: LoginsMap,
    logins_to_remove: LoginsList,
    *,
    config_overrides: Optional[CognitoIdentityClientConfig] = None,
) -> None

Unlinks a federated identity from an existing account. Unlinked logins will be considered new identities next time they are seen. Removing the last linked login will make this identity inaccessible.

This is a public API. You do not need any credentials to call this API.

Parameters:

  • identity_id (IdentityId) –

    A unique identifier in the format REGION:GUID.

  • logins (LoginsMap) –

    A set of optional name-value pairs that map provider names to provider tokens.

  • logins_to_remove (LoginsList) –

    Provider names to unlink from this identity.

Raises:

Source code in docs_src/capo_cognito_identity/_services/cognito_identity.py
def unlink_identity(
    self,
    identity_id: "capo_cognito_identity.types.identity_id.IdentityId",
    logins: "capo_cognito_identity.types.logins_map.LoginsMap",
    logins_to_remove: "capo_cognito_identity.types.logins_list.LoginsList",
    *,
    config_overrides: Optional[CognitoIdentityClientConfig] = None,
) -> None:
    """<p>Unlinks a federated identity from an existing account. Unlinked logins will be considered new identities next time they are seen. Removing the last linked login will make this identity inaccessible.</p> <p>This is a public API. You do not need any credentials to call this API.</p>

    Args:
        identity_id: <p>A unique identifier in the format REGION:GUID.</p>
        logins: <p>A set of optional name-value pairs that map provider names to provider tokens.</p>
        logins_to_remove: <p>Provider names to unlink from this identity.</p>

    Raises:
        capo_cognito_identity.errors.external_service_exception.ExternalServiceException: <p>An exception thrown when a dependent service such as Facebook or Twitter is not responding</p>
        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.unlink_identity_input.UnlinkIdentityInput]",
    ) -> OperationResponse[None]:
        import capo_cognito_identity._operations.aws_cognito_identity_service.unlink_identity

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

    def _redact_input(
        input_: "capo_cognito_identity.types.unlink_identity_input.UnlinkIdentityInput",
    ) -> dict[str, Any]:
        import capo_cognito_identity.types.unlink_identity_input

        return capo_cognito_identity.types.unlink_identity_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UnlinkIdentity", redact_input=_redact_input),
    )
    input_: capo_cognito_identity.types.unlink_identity_input.UnlinkIdentityInput = {
        "identity_id": identity_id,
        "logins": logins,
        "logins_to_remove": logins_to_remove,
    }

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