Skip to content

Add interactive prompts for Xero credentials during auth login#1

Merged
paulmeller merged 1 commit intomainfrom
claude/interactive-auth-prompts-pfg7q
Mar 18, 2026
Merged

Add interactive prompts for Xero credentials during auth login#1
paulmeller merged 1 commit intomainfrom
claude/interactive-auth-prompts-pfg7q

Conversation

@paulmeller
Copy link
Copy Markdown
Owner

Summary

Enhanced the auth login command to interactively prompt users for missing Xero credentials (Client ID and Client Secret) when running in a TTY environment, with an option to save them to the config file.

Key Changes

  • Interactive credential prompts: When Client ID is missing and the command is running in a TTY (not in --no-prompt mode), users are now prompted to enter their credentials instead of receiving an error
  • New prompt utility functions: Added three new helper functions to cmdutil/flags.go:
    • PromptString(): Prompts for regular text input
    • PromptSecret(): Prompts for masked password input using golang.org/x/term
    • PromptConfirmDefault(): Prompts for yes/no confirmation with "yes" as default
  • Config file persistence: After collecting credentials via prompts, users are offered the option to save them to the config file for future use
  • Smart save detection: Only prompts to save if credentials were actually entered via prompts (not already present in environment variables or config file)

Implementation Details

  • Respects the --no-prompt flag to disable interactive prompts in non-TTY environments
  • Checks both file-based and environment variable sources before prompting
  • Provides user-friendly error messages and feedback throughout the flow
  • Gracefully handles save failures with a warning rather than aborting the login process

https://claude.ai/code/session_01De6cUAbiu4rH33XRihzhoa

When stdin is a TTY and --no-prompt isn't set, the auth login command
now interactively prompts for client_id and client_secret instead of
immediately erroring. Users can optionally save the entered credentials
to ~/.config/xero-cli/config.toml.

https://claude.ai/code/session_01De6cUAbiu4rH33XRihzhoa
@paulmeller paulmeller merged commit 884b755 into main Mar 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants