From af385b31811ffbef519ab93d39e19bbac1699f35 Mon Sep 17 00:00:00 2001 From: duharry0915 Date: Tue, 17 Nov 2026 15:53:50 -0800 Subject: [PATCH] Make bare `auth login` prompt for an API key AgentMail authenticates with API keys and has no OAuth flow, so the CLI declared no login flow and `agentmail auth login` failed with "No login flow declared for scheme `BearerAuth`" unless `--with-token` was passed. Register a token-paste flow for BearerAuth in custom.rs (fernignored, so it survives regeneration). Bare `auth login` now prints where to get a key (console.agentmail.to/dashboard/api-keys) and reads it from stdin. Paste flows add no request-time provider, so AGENTMAIL_API_KEY and the keyring resolve exactly as before. Bump to 1.10.1 so this can ship without a regeneration: the publish job requires the tag to match Cargo.toml, and the next regeneration restamps the version anyway. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 2 +- Cargo.toml | 2 +- cli/agentmail/custom.rs | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8dfe9a..5a5fc2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,7 +10,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "agentmail-cli" -version = "1.10.0" +version = "1.10.1" dependencies = [ "agentmail_sdk", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 991574e..062d564 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "agentmail-cli" -version = "1.10.0" +version = "1.10.1" edition = "2021" description = "Command-line interface for the AgentMail API. Send, receive, reply, and manage threaded email conversations from your terminal." license = "MIT" diff --git a/cli/agentmail/custom.rs b/cli/agentmail/custom.rs index 75dc429..180ade3 100644 --- a/cli/agentmail/custom.rs +++ b/cli/agentmail/custom.rs @@ -13,6 +13,10 @@ //! Types are available via `agentmail_sdk::api::*`. use fern_cli_sdk::app::CliApp; +use fern_cli_sdk::auth::TokenPasteLoginFlow; + +/// Where `agentmail auth login` sends people to get an API key. +const API_KEYS_URL: &str = "https://console.agentmail.to/dashboard/api-keys"; /// Register custom commands on the CLI app builder. /// @@ -41,5 +45,12 @@ pub fn register(app: CliApp) -> CliApp { // Ok(()) // }), // ); - app + + // AgentMail authenticates with API keys; there is no OAuth flow to run. + // Without a declared flow, bare `agentmail auth login` fails with + // "No login flow declared for scheme `BearerAuth`". A paste flow makes it + // prompt for a key and say where to get one. It adds no request-time + // provider, so main.rs's BearerAuth binding (AGENTMAIL_API_KEY, then the + // keyring) is untouched. + app.login_flow(TokenPasteLoginFlow::new("BearerAuth").token_paste_url(API_KEYS_URL)) }