INNER CODE UNIT · Python
set_auth_token
MakazhanAlpamys/Soup · src/soup_cli/ui/app.py:300
def set_auth_token(token: str) -> None:
"""Replace the process-wide auth token (used by `soup ui --auth-token`).
Validates via `utils.qr_url.validate_token` so a malformed override
can't bypass the urlsafe-base64 shape check.
"""
from soup_cli.utils.qr_url import validate_token
validated = validate_token(token)
global _auth_token
with _auth_token_lock:
_auth_token = validated
# Ephemeral single-use tickets for SSE endpoints (v0.74.x #687)
# Valid for 30 seconds, single use only.
_tickets: dict[str, float] = {}
_tickets_lock = threading.Lock()