def login(connection):
    """Authenticate a user and create an HTTP session on the web server where
    the user's MicroStrategy sessions are stored.

    This request returns an authorization token (X-MSTR-AuthToken) which will be
    submitted with subsequent requests. The body of the request contains
    the information needed to create the session. The loginMode parameter in
    the body specifies the authentication mode to use. You can authenticate with
    one of the following authentication modes: Standard (1), Anonymous (8),
    or LDAP (16). Authentication modes can be enabled through the System
    Administration REST APIs, if they are supported by the deployment.

    Args:
        connection: MicroStrategy REST API connection object

    Returns:
        Complete HTTP response object.
    """

    return connection.post(
        skip_expiration_check=True,
        url=f'{connection.base_url}/api/auth/login',
        data={
            'username': connection.username,
            'password': connection._Connection__password,
            'loginMode': connection.login_mode,
            'applicationType': 35,
        },
    )