Use the ably login command to log in to your Ably account via OAuth. The CLI opens a browser, you authorize the request, and tokens are stored locally and auto-refreshed.
If your account has multiple accounts, apps, or API keys, the CLI prompts you to pick one.
Synopsis
ably login [options]Options
--alias | -a
Set an alias name for this account so you can switch between multiple accounts using ably accounts switch. If omitted, the CLI generates one from the account name.
--no-browser
Prevent the CLI from automatically opening a browser. The CLI displays the verification URL and user code to open manually.
--json
Output results as compact JSON. Mutually exclusive with --pretty-json.
--pretty-json
Output results in formatted JSON. Mutually exclusive with --json.
--verbose | -v
Enable verbose logging. Can be combined with --json or --pretty-json.
Examples
Log in to your Ably account using the browser:
ably loginLog in and set an alias for the account:
ably login --alias workLog in without opening a browser (for use over SSH or in headless environments):
ably login --no-browserLog in and output the result in JSON format:
ably login --jsonLog in and output the result in formatted JSON:
ably login --pretty-jsonSee also
- Accounts logout — Sign out and revoke stored OAuth tokens.
- Accounts switch — Switch between aliased accounts.
- Environment variables — Authenticate via environment variables instead of using OAuth login.
- CLI reference — Full list of available commands.