Clean up OAuth device-code callbacks

This commit is contained in:
Mario Zechner
2026-05-22 15:50:52 +02:00
parent b3ed545938
commit c841a6c78f
8 changed files with 56 additions and 18 deletions

View File

@@ -122,13 +122,17 @@ export class LoginDialogComponent extends Container implements Focusable {
this.contentContainer.addChild(new Spacer(1));
this.contentContainer.addChild(new Text(theme.fg("warning", `Enter code: ${info.userCode}`), 1, 0));
// Do not open device-code URLs automatically. These flows need to work in headless environments.
this.openUrl(info.verificationUri);
this.tui.requestRender();
}
private openUrl(url: string): void {
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
exec(`${openCmd} "${url}"`);
try {
exec(`${openCmd} "${url}"`, () => {});
} catch {
// Ignore browser launch failures. The URL remains visible for manual opening/copying.
}
}
/**