fix anthropic console auth (#2049)

This commit is contained in:
Dax
2025-08-18 17:12:21 -04:00
committed by GitHub
parent 5d12cadba7
commit f19586cebd
10 changed files with 121 additions and 24 deletions

View File

@@ -176,12 +176,20 @@ export const AuthLoginCommand = cmd({
spinner.stop("Failed to authorize", 1)
}
if (result.type === "success") {
await Auth.set(provider, {
type: "oauth",
refresh: result.refresh,
access: result.access,
expires: result.expires,
})
if ("refresh" in result) {
await Auth.set(provider, {
type: "oauth",
refresh: result.refresh,
access: result.access,
expires: result.expires,
})
}
if ("key" in result) {
await Auth.set(provider, {
type: "api",
key: result.key,
})
}
spinner.stop("Login successful")
}
}
@@ -197,12 +205,20 @@ export const AuthLoginCommand = cmd({
prompts.log.error("Failed to authorize")
}
if (result.type === "success") {
await Auth.set(provider, {
type: "oauth",
refresh: result.refresh,
access: result.access,
expires: result.expires,
})
if ("refresh" in result) {
await Auth.set(provider, {
type: "oauth",
refresh: result.refresh,
access: result.access,
expires: result.expires,
})
}
if ("key" in result) {
await Auth.set(provider, {
type: "api",
key: result.key,
})
}
prompts.log.success("Login successful")
}
}

View File

@@ -26,7 +26,7 @@ export namespace Plugin {
const plugins = [...(config.plugin ?? [])]
if (!Flag.OPENCODE_DISABLE_DEFAULT_PLUGINS) {
plugins.push("opencode-copilot-auth")
plugins.push("opencode-anthropic-auth")
plugins.push("opencode-anthropic-auth@0.0.2")
}
for (let plugin of plugins) {
log.info("loading plugin", { path: plugin })