login Command

Last updated January 14, 20262 min read

The login command authenticates the CLI with your Hooklistener account using a secure device code flow. This is required before using commands like tunnel, listen, or tui.

Usage

hooklistener login [OPTIONS]

Options

OptionDescription
--forceForce re-authentication even if already logged in
--helpShow help information

How It Works

The login command uses a device code flow (OAuth 2.0 Device Authorization Grant), which is secure and convenient for CLI applications:

  1. Request device code: The CLI requests a unique code from Hooklistener's servers.
  2. Display verification URL: You'll see a URL and code to enter in your browser.
  3. Authorize in browser: Open the URL, log in to your Hooklistener account, and approve the device.
  4. Token exchange: Once approved, the CLI automatically receives an access token.
  5. Secure storage: The token is stored securely in your local config file.

Security:Your password is never entered in the terminal. All authentication happens in your browser where you can verify the domain.

Examples

Basic Login

Run the login command and follow the prompts:

hooklistener login

You'll see output like:

Opening browser for authentication...
If the browser doesn't open, visit: https://hooklistener.com/cli
Enter the code: ABCD-1234

Waiting for authorization...
✓ Successfully authenticated as user@example.com

Force Re-authentication

If you need to switch accounts or refresh your token:

hooklistener login --force

Troubleshooting

Browser doesn't open automatically

Copy the URL from the terminal output and paste it into your browser manually. This can happen in headless environments or when the default browser isn't configured.

Code expired

Device codes expire after a few minutes for security. Simply run hooklistener login again to get a new code.

Already logged in

If you're already authenticated, the CLI will tell you. Use --force to re-authenticate if needed.

  • tunnel — Create a public URL to your local server (requires login)
  • listen — Forward webhooks from an endpoint (requires login)
  • tui — Interactive terminal UI (requires login)