auth
Authentication management commands for NDCLI. These commands handle OAuth2 authentication with the NetDefense platform.
Commands
| Command | Description |
|---|---|
auth login | Authenticate with NetDefense |
auth logout | Log out and revoke tokens |
auth show | Show current authentication status |
auth me | Show authenticated user information |
auth refresh | Force refresh the access token |
auth migrate | Migrate tokens from file to keyring |
auth login
Authenticate using the OAuth2 device authorization flow. This opens your default browser to complete authentication.
ndcli auth login [flags]Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--force | bool | false | Force new login even if already authenticated |
--scopes | string | from config | OAuth2 scopes to request |
Examples
# Standard loginndcli auth login
# Force re-authenticationndcli auth login --force
# Login with custom scopesndcli auth login --scopes "openid profile email"How It Works
-
Request device code — NDCLI requests a device code from the authentication server
-
Display verification URL — A URL and user code are displayed in your terminal
-
Browser authentication — Your browser opens to the authentication page
-
Enter code — Enter the user code and complete authentication
-
Tokens stored — NDCLI receives and securely stores your tokens
auth logout
Log out and revoke the current access tokens. This removes stored credentials from the keyring or file storage.
ndcli auth logoutExamples
ndcli auth logoutauth show
Display the current authentication status including token expiry information.
ndcli auth showOutput
- Auth Status — Whether you’re authenticated or not
- Storage Location — Keyring or file-based storage
- Token Expiry — When your access token expires
- Refresh Token — Whether a refresh token is available
Examples
ndcli auth showauth me
Show detailed information about the currently authenticated user.
ndcli auth meOutput
Displays user profile information retrieved from the authentication server:
- Email — Your registered email address
- Name — Your display name
- User ID — Unique identifier
- Profile — Other profile attributes
Examples
# View your user infondcli auth me
# Output as JSONndcli auth me -f jsonauth refresh
Force refresh the access token using the stored refresh token. This is typically handled automatically by NDCLI when needed.
ndcli auth refreshUse Cases
Examples
ndcli auth refreshauth migrate
Migrate authentication tokens from file-based storage to the system keyring. This improves security by storing tokens in the OS credential manager.
ndcli auth migrateSupported Keyrings
| Platform | Keyring |
|---|---|
| macOS | Keychain |
| Linux | Secret Service (GNOME Keyring, KWallet) |
| Windows | Credential Manager |
Examples
ndcli auth migrate