Authentication Commands
The PipeOps CLI authentication commands manage login, logout, session status, and user account information.
pipeops login
Authenticate with PipeOps using OAuth 2.0 with PKCE flow.
Usage
pipeops login [flags]
Description
Opens your default web browser to complete OAuth authentication. Once authenticated, the CLI stores your access token locally for future commands.
Flags
| Flag | Type | Description |
|---|---|---|
--browser | boolean | Open browser automatically (default: true) |
--no-browser | boolean | Display auth URL without opening browser |
Examples
Standard login:
pipeops login
Login without opening browser:
pipeops login --no-browser
Output:
Please open this URL in your browser to authenticate:
https://console.pipeops.io/cli-auth?code=ABC123
Waiting for authentication...
✓ Successfully authenticated as [email protected]
What Happens
- CLI generates a secure PKCE code challenge
- Opens browser to PipeOps authentication page
- You authorize the CLI application
- CLI receives authorization code
- Exchanges code for access token
- Stores token in
~/.pipeops.json
Authentication Flow
The CLI uses OAuth 2.0 with PKCE (Proof Key for Code Exchange) for secure authentication:
- Secure: No passwords stored locally
- Device-friendly: Works on headless servers with
--no-browser - Token-based: Automatic token refresh
- Scoped: Minimal required permissions
Troubleshooting
Browser doesn't open:
# Manually copy and open the URL
pipeops login --no-browser
Authentication timeout:
# Restart the process
pipeops login
Permission denied:
# Check file permissions
chmod 600 ~/.pipeops.json
pipeops logout
Sign out and remove local credentials.
Usage
pipeops logout [flags]
Description
Removes the authentication token from local configuration. After logout, you'll need to run pipeops login again to use authenticated commands.
Flags
| Flag | Type | Description |
|---|---|---|
--force | boolean | Skip confirmation prompt |
Examples
Standard logout:
pipeops logout
Output:
Are you sure you want to logout? [y/N] y
✓ Successfully logged out
Force logout without confirmation:
pipeops logout --force
What Gets Removed
- Access token from
~/.pipeops.json - Session information
- Cached credentials
Logging out does not revoke the token on the server. To fully revoke access, log in to the web console and revoke the CLI application under Settings > Security > Authorized Applications.
pipeops status
Check current authentication status.
Usage
pipeops status [flags]
Description
Verifies if you're currently authenticated and displays session information.
Examples
Check auth status:
pipeops status
Output when authenticated:
✓ Authenticated as [email protected]
Token expires: 2024-12-31 23:59:59
Output when not authenticated:
✗ Not authenticated
Run 'pipeops login' to authenticate
JSON output:
pipeops status --json
{
"authenticated": true,
"expires_at": "2024-12-31T23:59:59Z",
"token_valid": true
}
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Authenticated and token is valid |
| 1 | Not authenticated or token is invalid |
Usage in Scripts
# Check if authenticated before running commands
if pipeops status > /dev/null 2>&1; then
echo "Authenticated, proceeding..."
pipeops project list
else
echo "Not authenticated, please login"
pipeops login
fi
pipeops me
Display current user information.
Usage
pipeops me [flags]
Description
Shows detailed information about the currently authenticated user.
Examples
View user info:
pipeops me
Output:
Email: [email protected]
Name: John Doe
Organization: Acme Corp
Role: Admin
Account ID: usr_1234567890
JSON output:
pipeops me --json
{
"id": "usr_1234567890",
"name": "John Doe",
"organization": "Acme Corp",
"role": "admin",
"created_at": "2024-01-01T00:00:00Z"
}
Use Cases
- Verify which account you're using
- Check your role and permissions
- Get your user ID for API operations
- Confirm organization membership
Common Usage Patterns
CI/CD Authentication
For CI/CD pipelines, use environment variables instead of interactive login:
# Set token from secrets
export PIPEOPS_AUTH_TOKEN=${{ secrets.PIPEOPS_TOKEN }}
# Verify authentication
pipeops status
# Run commands
pipeops list
pipeops status proj-123
Multiple Accounts
Manage multiple PipeOps accounts using different config files:
# Login to production account
PIPEOPS_CONFIG_PATH=~/.pipeops-prod.json pipeops login
# Login to staging account
PIPEOPS_CONFIG_PATH=~/.pipeops-staging.json pipeops login
# Use specific account
alias pipeops-prod='PIPEOPS_CONFIG_PATH=~/.pipeops-prod.json pipeops'
alias pipeops-staging='PIPEOPS_CONFIG_PATH=~/.pipeops-staging.json pipeops'
Token Security
Best practices for token management:
-
Never commit tokens to version control:
echo ".pipeops.json" >> .gitignore -
Protect config file:
chmod 600 ~/.pipeops.json -
Use secrets management in CI/CD:
- GitHub Actions: Use encrypted secrets
- GitLab CI: Use masked variables
- Jenkins: Use credentials plugin
-
Rotate tokens regularly:
pipeops logoutpipeops login
Headless Servers
For servers without a browser:
# On the headless server
pipeops login --no-browser
# Copy the URL and open it on your local machine
# After authorization, the server CLI will authenticate automatically
Or use a pre-generated token:
# Set token directly
export PIPEOPS_AUTH_TOKEN="your-token-here"
# Or add to config file
echo '{"auth_token":"your-token-here"}' > ~/.pipeops.json
Error Messages
Common Errors
"Not authenticated":
Error: not authenticated
Run 'pipeops login' to authenticate
Solution: Run pipeops login
"Token expired":
Error: authentication token has expired
Run 'pipeops login' to re-authenticate
Solution: Run pipeops login to refresh
"Invalid token":
Error: invalid authentication token
Run 'pipeops login' to re-authenticate
Solution: Run pipeops logout then pipeops login
"Permission denied":
Error: failed to write config file: permission denied
Solution: Check file permissions: chmod 600 ~/.pipeops.json
Related Commands
- Configuration: Configure authentication settings
- Troubleshooting: Authentication troubleshooting