Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 1

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

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.