diff options
| author | Goni Zahavy <[email protected]> | 2026-04-13 04:37:57 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-12 20:37:57 -0500 |
| commit | ae17b416b8da910f43b8dca5356de41ef72d2685 (patch) | |
| tree | ef2790b0e6aabff25cb420deea9f4af7e4ef34d0 | |
| parent | 8ffadde85c89230bdca6b26a6e5b957cbfae7281 (diff) | |
| download | opencode-ae17b416b8da910f43b8dca5356de41ef72d2685.tar.gz opencode-ae17b416b8da910f43b8dca5356de41ef72d2685.zip | |
fix(cli): auth login now asks for api key in handlePluginAuth (#21641)
Co-authored-by: Aiden Cline <[email protected]>
| -rw-r--r-- | packages/opencode/src/cli/cmd/providers.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/providers.ts b/packages/opencode/src/cli/cmd/providers.ts index 1ab0ecc7b..52da44190 100644 --- a/packages/opencode/src/cli/cmd/providers.ts +++ b/packages/opencode/src/cli/cmd/providers.ts @@ -148,6 +148,12 @@ async function handlePluginAuth(plugin: { auth: PluginAuth }, provider: string, } if (method.type === "api") { + const key = await prompts.password({ + message: "Enter your API key", + validate: (x) => (x && x.length > 0 ? undefined : "Required"), + }) + if (prompts.isCancel(key)) throw new UI.CancelledError() + if (method.authorize) { const result = await method.authorize(inputs) if (result.type === "failed") { @@ -157,7 +163,7 @@ async function handlePluginAuth(plugin: { auth: PluginAuth }, provider: string, const saveProvider = result.provider ?? provider await Auth.set(saveProvider, { type: "api", - key: result.key, + key: result.key ?? key, }) prompts.log.success("Login successful") } |
