Saltar al contenido principal

AuthService

Obtiene el token Bearer usando la API Key. No guarda estado, por lo que es seguro entre hilos.

Ejemplo General​

```python
import httpx

servicio = AuthService(config, httpx.Client())
token = servicio.authenticate()
```

Métodos​

def __init__(config: ShoriConfig, client: httpx.Client) -> None​

Crea el servicio.

Parámetros:

  • config (ShoriConfig) — Configuración del cliente.
  • client (httpx.Client) — httpx.Client compartido.

Ejemplo de uso:

```python
servicio = AuthService(config, httpx.Client())
```

def authenticate() -> str​

Autentica con GET \{identify_url\}/v3/authentication enviando X-ApiKey.

Retorna: str — Token Bearer.

Lanza:

  • AuthenticationException — Timeout, error de red, HTTP ≥ 400, JSON inválido o

Ejemplo de uso:

```python
token = servicio.authenticate()
```