mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 18:03:50 +00:00
feat(oauth): show paste input immediately during OpenAI Codex login (#468)
Previously, users had to wait up to 60 seconds for the browser callback to timeout before being prompted to paste the authorization code. This was problematic for SSH/VPS sessions where the callback cannot work. Now the paste input is shown immediately alongside the browser flow: - Browser callback and manual paste race - whichever completes first wins - Desktop users: browser callback succeeds, input is cleaned up - SSH/VPS users: paste code immediately without waiting Changes: - Add cancelWait() to OAuth server for early termination of polling loop - Add onManualCodeInput callback that races with browser callback - Show paste input immediately in TUI for openai-codex provider - Clean up input on success, error, or when browser callback wins Co-authored-by: cc-vps <crcatala+vps@gmail.com>
This commit is contained in:
parent
817221b79f
commit
05b9d55656
3 changed files with 121 additions and 4 deletions
|
|
@ -161,6 +161,8 @@ export class AuthStorage {
|
|||
onAuth: (info: { url: string; instructions?: string }) => void;
|
||||
onPrompt: (prompt: { message: string; placeholder?: string }) => Promise<string>;
|
||||
onProgress?: (message: string) => void;
|
||||
/** For providers with local callback servers (e.g., openai-codex), races with browser callback */
|
||||
onManualCodeInput?: () => Promise<string>;
|
||||
},
|
||||
): Promise<void> {
|
||||
let credentials: OAuthCredentials;
|
||||
|
|
@ -186,7 +188,12 @@ export class AuthStorage {
|
|||
credentials = await loginAntigravity(callbacks.onAuth, callbacks.onProgress);
|
||||
break;
|
||||
case "openai-codex":
|
||||
credentials = await loginOpenAICodex(callbacks);
|
||||
credentials = await loginOpenAICodex({
|
||||
onAuth: callbacks.onAuth,
|
||||
onPrompt: callbacks.onPrompt,
|
||||
onProgress: callbacks.onProgress,
|
||||
onManualCodeInput: callbacks.onManualCodeInput,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown OAuth provider: ${provider}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue