hscli uses OAuth 2.0 to authenticate with the Help Scout API. Two grant types are supported: Authorization Code (interactive, for humans) and Client Credentials (non-interactive, for CI/CD and service accounts).
Before using the CLI you need to create an OAuth application in Help Scout. The hscli auth setup wizard walks you through this.
hscli auth setupThe wizard will:
- Open your browser to My Profile > My Apps in Help Scout.
- Prompt you to create an app with the redirect URL
http://127.0.0.1:9999/callback. - Ask you to paste the App ID and App Secret.
- Validate the credentials against the Help Scout API.
- Store the App ID in your profile config and the tokens in your OS keychain.
Pass credentials directly via flags to skip the interactive prompts:
hscli auth setup --app-id <id> --app-secret <secret>Both --app-id and --app-secret must be provided together.
Help Scout OAuth applications are account-scoped -- each user creates their own app under their Help Scout account.
- Log in to Help Scout.
- Go to My Profile > My Apps (bottom of the profile page).
- Click Create My App.
- Fill in the form:
- App Name: anything you like (e.g. "hscli").
- Redirection URL:
http://127.0.0.1:9999/callback
- Click Create Application.
- Copy the App ID and App Secret -- you will need them for
hscli auth setuporhscli auth login.
Opens a browser window for interactive authentication. Best for personal use.
hscli auth loginHow it works:
- The CLI resolves OAuth credentials (from flags, env vars, or profile config).
- A local HTTP server starts on
127.0.0.1:9999(the port registered as the app's Redirection URL). - Your browser opens the Help Scout authorization page.
- You click Allow in the Help Scout UI.
- Help Scout redirects to the local server with an authorization code.
- The CLI exchanges the code for an access token and refresh token.
- Tokens are stored in your OS keychain.
- The access token auto-refreshes on 401 responses using the refresh token.
You can pass explicit credentials to override what is stored in your profile:
hscli auth login --app-id <id> --app-secret <secret>Authenticates without a browser. Best for CI/CD pipelines and service accounts.
hscli auth login --client-credentials --app-id <id> --app-secret <secret>Or via environment variables:
export HSCLI_APP_ID=your-app-id
export HSCLI_APP_SECRET=your-app-secret
hscli auth login --client-credentialsThis flow does not produce a refresh token. When the token expires (48 hours), the CLI automatically re-authenticates using the stored client credentials.
Profiles let you manage multiple Help Scout accounts or configurations without re-authenticating.
hscli auth login --profile work
hscli auth login --profile personalhscli profile use workAll subsequent commands use the active profile unless overridden with --profile <name>.
hscli profile listShows all configured profiles. The active profile is marked with *. Authenticated profiles show (authenticated).
hscli profile currentAny command accepts --profile <name> to use a different profile for that invocation:
hscli conv list --profile personalYou can also set the profile via the HSCLI_PROFILE environment variable.
For non-interactive environments, configure authentication entirely through environment variables:
| Variable | Description |
|---|---|
HSCLI_APP_ID |
OAuth App ID |
HSCLI_APP_SECRET |
OAuth App Secret |
HSCLI_AUTH_MODE |
Set to client_credentials to skip the browser flow |
HSCLI_PROFILE |
Profile name to use (default: default) |
env:
HSCLI_APP_ID: ${{ secrets.HELPSCOUT_APP_ID }}
HSCLI_APP_SECRET: ${{ secrets.HELPSCOUT_APP_SECRET }}
HSCLI_AUTH_MODE: client_credentials
steps:
- run: npm install -g @wavyx/hscli
- run: hscli auth login --client-credentials
- run: hscli conv list --status active --output jsonTokens are stored securely using a two-tier strategy:
- OS Keychain (preferred) -- uses
@napi-rs/keyringto store tokens in macOS Keychain, Windows Credential Vault, or Linux libsecret. - Encrypted file fallback -- if the OS keychain is unavailable (e.g. headless servers, containers), tokens are stored in an encrypted file via the
conflibrary at the platform-appropriate config directory.
Tokens are stored under the key hscli/<profile>/tokens and include the access token, refresh token (if applicable), expiry timestamp, auth mode, and credential source.
Run hscli auth status to see which storage backend is in use.
Configure your own Help Scout OAuth app. Validates credentials against the API before saving.
hscli auth setup # Interactive wizard
hscli auth setup --app-id <id> --app-secret <secret> # Non-interactiveAuthenticate with Help Scout.
hscli auth login # Authorization Code (opens browser)
hscli auth login --client-credentials # Client Credentials (no browser)
hscli auth login --app-id <id> --app-secret <secret> # Explicit credentials
hscli auth login --profile work # Log in to a specific profileShow the current authentication state: profile, keychain type, auth mode, token expiry, and authenticated user info.
hscli auth statusForce-refresh the stored access token. Only works with Authorization Code sessions that have a refresh token. Client Credentials sessions should use hscli auth login to re-authenticate.
hscli auth refreshRemove stored credentials for the active profile.
hscli auth logout
hscli auth logout --profile work