pub struct AuthLoginCommand { /* private fields */ }Expand description
Authenticate with Claude.
§Billing mode
As of Claude Code 2.1.x the CLI supports two billing paths:
Claude subscription (--claudeai, the default) and Anthropic
Console / API usage (--console). Use Self::mode to pin
the path explicitly – Console-billed teams need to, or
they’ll land in the wrong account on first auth.
§Example
use claude_wrapper::{Claude, ClaudeCommand, AuthLoginCommand};
use claude_wrapper::command::auth::LoginMode;
let claude = Claude::builder().build()?;
AuthLoginCommand::new()
.mode(LoginMode::Console)
.email("user@example.com")
.execute(&claude)
.await?;Implementations§
Source§impl AuthLoginCommand
impl AuthLoginCommand
Sourcepub fn mode(self, mode: LoginMode) -> Self
pub fn mode(self, mode: LoginMode) -> Self
Pin the billing path (--claudeai or --console). The CLI
defaults to Claudeai when neither flag is passed; setting
this explicitly is the only way Console-billed teams reach
their account.
Sourcepub fn force_sso(self) -> Self
pub fn force_sso(self) -> Self
Force the SSO login flow (--sso). Boolean flag with no
value – replaces the historical Self::sso which took a
provider name and emitted invalid args (the CLI’s --sso
has been boolean since at least 2.1.x).
Sourcepub fn sso(self, provider: impl Into<String>) -> Self
👎Deprecated since 0.10.0: the --sso flag is a boolean since at least Claude Code 2.1.x. Use force_sso() instead. The value passed here is ignored at emit time; the boolean intent is preserved.
pub fn sso(self, provider: impl Into<String>) -> Self
the --sso flag is a boolean since at least Claude Code 2.1.x. Use force_sso() instead. The value passed here is ignored at emit time; the boolean intent is preserved.
Deprecated. Set the SSO provider for authentication.
The CLI’s --sso is a boolean flag with no value (since at
least Claude Code 2.1.x). Passing a provider string caused
the wrapper to emit --sso <provider>, which the CLI parsed
as --sso plus an extra positional that was silently
ignored or mishandled. Use Self::force_sso for the
correct boolean form.
Kept as a compile-error-and-deprecation-warning bridge so callers see the change. The value is intentionally ignored at args() emit time – only the boolean intent is preserved.
Trait Implementations§
Source§impl ClaudeCommand for AuthLoginCommand
impl ClaudeCommand for AuthLoginCommand
Source§impl Clone for AuthLoginCommand
impl Clone for AuthLoginCommand
Source§fn clone(&self) -> AuthLoginCommand
fn clone(&self) -> AuthLoginCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuthLoginCommand
impl Debug for AuthLoginCommand
Source§impl Default for AuthLoginCommand
impl Default for AuthLoginCommand
Source§fn default() -> AuthLoginCommand
fn default() -> AuthLoginCommand
Auto Trait Implementations§
impl Freeze for AuthLoginCommand
impl RefUnwindSafe for AuthLoginCommand
impl Send for AuthLoginCommand
impl Sync for AuthLoginCommand
impl Unpin for AuthLoginCommand
impl UnsafeUnpin for AuthLoginCommand
impl UnwindSafe for AuthLoginCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClaudeCommandSyncExt for Twhere
T: ClaudeCommand<Output = CommandOutput>,
impl<T> ClaudeCommandSyncExt for Twhere
T: ClaudeCommand<Output = CommandOutput>,
Source§fn execute_sync(&self, claude: &Claude) -> Result<CommandOutput, Error>
fn execute_sync(&self, claude: &Claude) -> Result<CommandOutput, Error>
ClaudeCommand::execute for commands
producing CommandOutput.