token
token ¶
Token-based authentication classes for Domo (access tokens).
DomoTokenAuth
dataclass
¶
DomoTokenAuth(
domo_access_token: str,
domo_instance: 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
Token-based authentication using pre-generated access tokens.
This authentication method uses access tokens generated from Domo's admin panel (Admin > Access Tokens). This is particularly useful in environments where direct username/password authentication is not permitted or for automated systems.
Attributes:
| Name | Type | Description |
|---|---|---|
domo_access_token |
str
|
Pre-generated access token (not shown in repr) |
domo_instance |
str
|
The Domo instance identifier |
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 = DomoTokenAuth( ... domo_access_token="your-access-token-here", ... domo_instance="mycompany" ... ) token = await auth.get_auth_token()
auth_header
property
¶
auth_header: dict
Generate the authentication header for access token based authentication.
get_auth_token
async
¶
get_auth_token(
token_name: str | None = None, **context_kwargs
) -> str
Retrieve the access token, updating internal attributes as necessary.
Source code in src/crew_dcs/auth/token.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |