Skip to content

full

full

Full authentication classes for Domo (username/password).

DomoFullAuth dataclass

DomoFullAuth(
    domo_instance: str,
    domo_username: str,
    domo_password: str,
    token_name: str | None = None,
    token: str | None = None,
    user_id: str | None = None,
    is_valid_token: bool = False,
    cache_responses: bool = False,
    cache_size: int = 1000,
    cache_default_ttl: int = 300,
    cache_strategy: str | None = None,
    custom_cache_rules: dict[str, list[str]] | None = None,
)

Bases: DomoAuth

Full authentication using Domo username and password.

This class provides authentication using Domo credentials (username and password) to obtain session tokens. It's typically used for direct user authentication where username/password login is permitted.

Attributes:

Name Type Description
domo_instance str

The Domo instance identifier

domo_username str

Domo username for authentication

domo_password str

Domo password for authentication (not shown in repr)

token_name str | None

Name identifier for the token

token str | None

The authentication token (not shown in repr)

user_id str | None

The authenticated user's ID

is_valid_token bool

Whether the current token is valid

cache_responses bool

Enable HTTP response caching (default: False)

cache_size int

Maximum number of cache entries (default: 1000)

cache_default_ttl int

Default cache TTL in seconds (default: 300)

cache_strategy str | None

Cache invalidation strategy (default: None, uses SMART)

custom_cache_rules dict | None

Custom cache invalidation rules (default: None)

Example

auth = DomoFullAuth( ... domo_instance="mycompany", ... domo_username="user@company.com", ... domo_password="", # pragma: allowlist secret ... ) token = await auth.get_auth_token()

auth_header property

auth_header: dict

Generate the full authentication header specific to product APIs.

get_auth_token async

get_auth_token(
    return_raw: bool = False, **context_kwargs
) -> str | ResponseGetData

Retrieve the authentication token from product APIs using the provided credentials.

Source code in src/crew_dcs/auth/full.py
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
@log_call(
    level_name="auth",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_auth_token(
    self,
    return_raw: bool = False,
    **context_kwargs,
) -> str | ResponseGetData:
    """Retrieve the authentication token from product APIs using the provided credentials."""
    from ..routes import auth as auth_routes

    res = await auth_routes.get_full_auth(
        auth=None,
        domo_instance=self.domo_instance,
        domo_username=self.domo_username,
        domo_password=self.domo_password,
        parent_class=self.__class__.__name__,
        **context_kwargs,
    )

    if return_raw:
        return res

    if res.is_success and res.response:
        self.is_valid_token = True

        token = str(res.response.get("sessionToken", ""))
        self.token = token
        self.token_name = self.token_name or "full_auth"

    if not self.token:
        raise AuthError(message="Failed to retrieve authentication token")

    return self.token