From 67082e21d93e24a347a6cac20a0113589ff7199b Mon Sep 17 00:00:00 2001 From: Alex Schapiro Date: Wed, 26 Aug 2026 21:02:57 +0000 Subject: [PATCH] fix(cli): reject sign-in responses without an API token --- strix/interface/platform_cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/strix/interface/platform_cli.py b/strix/interface/platform_cli.py index f50e3a8a..90ff82e5 100644 --- a/strix/interface/platform_cli.py +++ b/strix/interface/platform_cli.py @@ -195,7 +195,7 @@ def _run_device_flow( except requests.RequestException: continue if poll.ok: - return _json_object(poll) + return _signed_in_record(poll) error = "" with contextlib.suppress(ValueError, AttributeError): error = str(poll.json().get("error", "")) @@ -213,6 +213,13 @@ def _run_device_flow( raise PlatformAuthError("the sign-in request expired. Run `strix login` again.") +def _signed_in_record(response: requests.Response) -> dict[str, Any]: + record = _json_object(response) + if not str(record.get("api_token") or ""): + raise PlatformAuthError("the server returned a sign-in response without an API token") + return record + + def _json_object(response: requests.Response) -> dict[str, Any]: try: data = response.json()