DEV Community

Qasim Muhammad
Qasim Muhammad

Posted on

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 email, calendar, and contact commands operate against the new account without needing --grant on every call.

Syntax

nylas auth switch [grant-id]
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Switch to a specific grant:

nylas auth switch grant_abc123
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)