abso login says it is waiting for approval, and that Ctrl-C stops it, then says it is still waiting about once a minute. It stops by itself when the code runs out, and never waits past 30 minutes whatever the server's expires_in says. A login that said nothing for 15 minutes looked like a hang. Version 58 of shared· pinch· Oct 10 (2026-10-10 02:07 UTC) · Not checked
Version 57 · Files at version 58
2 files, 38 lines added, 1 removed.
--- a/client/src/box.ts
+++ b/client/src/box.ts
@@ -174,6 +174,11 @@
177 + /** The longest login waits for approval, whatever the server says. */ 178 + const MAX_LOGIN_WAIT_S = 30 * 60; 179 + /** How often login says it's still waiting. */ 180 + const STILL_WAITING_MS = 60_000; 177 182 export interface LoginIo { 178 183 readonly fetch?: typeof fetch; 179 184 readonly sleep?: (ms: number) => Promise<void>; @@ -193,13 +198,21 @@
193 198 const start = await call(server, "/login/device", { name: boxName(), client: "abso" }, undefined, fetcher); 194 199 const { device_code: device, user_code: code, verification_uri_complete: link } = start.body; 195 200 let interval = Number(start.body.interval) || 5; 196 − const expiresIn = Number(start.body.expires_in) || 900;
201 + // The server says when its code runs out; a server that says never still gets an end. 202 + const expiresIn = Math.min(Number(start.body.expires_in) || 900, MAX_LOGIN_WAIT_S); 197 203 if (typeof code !== "string" || typeof link !== "string" || typeof device !== "string") 198 204 throw new UsageError(`${originOf(server)} didn't give a code to approve`); 199 205 io.say(`To sign this box in, open ${link} and approve the code ${code}.`); 206 + io.say("Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out."); 200 207 const until = now() + expiresIn * 1000; 201 209 while (now() < until) { 202 210 await sleep(interval * 1000); 211 + // A wait with no word looks like a hang, so say it's still waiting now and then. 212 + if (now() - toldAt >= STILL_WAITING_MS) { 213 + io.say(`Still waiting for the code ${code} to be approved.`); 203 216 const a = await call(server, "/login/token", { device_code: device }, undefined, fetcher); 204 217 if (a.status === 400) { 205 218 if (a.body.error === "authorization_pending") continue; --- a/client/test/box.test.ts
+++ b/client/test/box.test.ts
@@ -91,6 +91,7 @@
92 92 assert.deepEqual(said, [ 93 93 "To sign this box in, open https://abso.dev/login/box?code=WXYZ-BCDF and approve the code WXYZ-BCDF.", 94 + "Waiting for approval. Ctrl-C stops waiting, and abso stops by itself when the code runs out.", 95 96 assert.equal(readBox(SERVER, h)?.credential, CREDENTIAL); 96 97 const files = readdirSync(join(h, ".abso", "boxes")); @@ -160,6 +161,29 @@
160 161 assert.equal(readBox(SERVER, h), undefined); 164 + test("login says it's still waiting about once a minute, and stops in the end whatever the server says", async () => { 166 + const said: string[] = []; 167 + const pending = Array.from({ length: 2000 }, (): [number, unknown] => [400, { error: "authorization_pending" }]); 168 + await assert.rejects( 172 + fetch: server([[200, { ...started, expires_in: 10 ** 9, interval: 5 }], ...pending], []), 175 + say: (line) => said.push(line), 179 + /nobody approved the code WXYZ-BCDF in time\. Run abso login again\./, 181 + assert.equal(c.slept(), 30 * 60 * 1000, "a server that says never still gets an end"); 182 + const still = said.filter((line) => line === "Still waiting for the code WXYZ-BCDF to be approved."); 183 + assert.equal(still.length, 30); 184 + assert.equal(said.length, 2 + 30); 163 187 test("a key is minted with the box credential, sent only to the box's own server", async () => { 164 188 const seen: Seen = []; 165 189 const minted = await mintKey(