Switch active account with nylas auth switch
Authentication is the gate between your terminal and your mailbox. nylas auth switch handles it. The nylas auth switch command changes which connected email account the CLI targets by default. After switching, all emai
Authentication is the gate between your terminal and your mailbox. nylas auth switch handles it.
The nylas auth switch command changes which connected email account the CLI targets by default. After switching, all email, calendar, and contact commands operate against the new account without needing --grant on every call.
Syntax
nylas auth switch [grant-id]
When to Use This
Reach for nylas auth switch during initial setup, in CI/CD pipelines, or when managing multiple connected accounts. Combine with --json to pipe output into other tools.
Examples
Switch interactively:
nylas auth switch
Switch to a specific grant:
nylas auth switch grant_abc123
How It Works
The CLI stores credentials securely in your system keychain (macOS Keychain, Linux Secret Service, or Windows Credential Manager). Tokens are refreshed automatically รขโฌโ you authenticate once and commands just work.
Key Flags
Run nylas auth switch --help to see all available flags. Add --json for machine-readable output รขโฌโ useful when piping into jq or feeding data to scripts.
nylas auth switch --help
Full docs: nylas auth switch reference รขโฌโ all flags, advanced examples, and troubleshooting.
All commands: Nylas CLI Command Reference
Get started: brew install nylas/nylas-cli/nylas รขโฌโ other install methods
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.