fix(cli): handlePluginAuth asks for api key only if authorize method exists (#22475)
This commit is contained in:
parent
68384613be
commit
9a5178e4ac
1 changed files with 6 additions and 6 deletions
|
|
@ -158,13 +158,13 @@ async function handlePluginAuth(plugin: { auth: PluginAuth }, provider: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method.type === "api") {
|
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) {
|
if (method.authorize) {
|
||||||
|
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()
|
||||||
|
|
||||||
const result = await method.authorize(inputs)
|
const result = await method.authorize(inputs)
|
||||||
if (result.type === "failed") {
|
if (result.type === "failed") {
|
||||||
prompts.log.error("Failed to authorize")
|
prompts.log.error("Failed to authorize")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue