login Command
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
| Option | Description |
|---|---|
--force | Force re-authentication even if already logged in |
--help | Show 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:
- Request device code: The CLI requests a unique code from Hooklistener's servers.
- Display verification URL: You'll see a URL and code to enter in your browser.
- Authorize in browser: Open the URL, log in to your Hooklistener account, and approve the device.
- Token exchange: Once approved, the CLI automatically receives an access token.
- 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 loginYou'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.comForce Re-authentication
If you need to switch accounts or refresh your token:
hooklistener login --forceTroubleshooting
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.