def delegate(connection, identity_token, whitelist=None):
    """Returns authentication token and cookies from given X-MSTR-
    IdentityToken.

    Args:
        connection: MicroStrategy REST API connection object
        identity_token: Identity token
        whitelist: list of errors for which we skip printing error messages

    Returns:
        Complete HTTP response object.
    """
    return connection.post(
        skip_expiration_check=True,
        url=f'{connection.base_url}/api/auth/delegate',
        json={
            'loginMode': "-1",
            'identityToken': identity_token
        },
    )