Auth¶
pynteracta.auth
¶
Authentication: service-account key parsing, JWT assertion, token cache.
ServiceAccountKey
dataclass
¶
TokenManager
¶
Manages token lifecycle: obtain, cache, refresh.
Source code in src/pynteracta/auth.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
get_token()
¶
Return a valid access token, refreshing if near expiry.
Source code in src/pynteracta/auth.py
GoogleOAuth2Credentials
dataclass
¶
Credentials for the Google-OAuth2 authentication method.
Supply exactly one of:
token: a static Google OAuth2 access token (min scopeprofile), ortoken_provider: a callable returning a fresh Google access token on demand.
The library never runs a Google browser/PKCE flow; obtaining the Google access token is
the caller's responsibility (see docs/authentication.md). The Google identity must
already be linked to an Interacta user.
Source code in src/pynteracta/auth.py
get_google_token()
¶
Return the current Google access token (static value or provider result).
Source code in src/pynteracta/auth.py
GoogleOAuth2TokenManager
¶
Obtains an Interacta access token by exchanging a Google OAuth2 access token.
Mirrors :class:TokenManager's public surface (:meth:get_token / :meth:invalidate)
so it is interchangeable as a :class:HttpTransport token provider/invalidator. The
Interacta access token is cached and refreshed exactly like the service-account flow; the
cache key is the profile name (the Google flow has no client_id).
Source code in src/pynteracta/auth.py
get_token()
¶
Return a valid Interacta access token, refreshing if near expiry.
Source code in src/pynteracta/auth.py
TokenCache
¶
Bases: Protocol
Pluggable token-cache backend.
Source code in src/pynteracta/auth.py
CachedToken
dataclass
¶
FileTokenCache
¶
File-backed token cache with POSIX 0o600 / 0o700 enforcement.
Source code in src/pynteracta/auth.py
MemoryTokenCache
¶
In-process token cache (not persisted across restarts).
Source code in src/pynteracta/auth.py
load_service_account_key(path)
¶
Parse a service-account key JSON file into :class:ServiceAccountKey.
Expected schema (per official vendor docs):
.. code-block:: json
{
"type": "service_account",
"private_key_id": 42,
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_id": 1001
}
Raises:
| Type | Description |
|---|---|
AuthenticationError
|
If the file is unreadable, not valid JSON, |
Source code in src/pynteracta/auth.py
pynteracta.api.auth
¶
Authentication resource client (endpoints 1-2).
AuthAPI
¶
Bases: ResourceClient
Client for /core/auth/* endpoints.
Source code in src/pynteracta/api/auth.py
create_access_token_raw(req)
¶
POST /core/auth/create-access-token-by-service-account (escape hatch).
Uses the unauthenticated transport so no bearer token is sent with the service-account assertion request.
Source code in src/pynteracta/api/auth.py
current_user_data()
¶
GET /core/auth/current-user-data — identity of the authenticated principal.