wit token command lets you create and manage Personal Access Tokens (PATs) for authenticating with the wit platform API and CLI.
Overview
- Authenticate CLI commands with the wit server
- Access the wit API programmatically
- Automate tasks in CI/CD pipelines
- Grant limited access to third-party tools
Commands
create
Create a new personal access token.Options
Examples
Example Output
list
List all your personal access tokens.Example Output
revoke
Revoke (delete) a personal access token.Arguments
Examples
Example Output
scopes
List all available token scopes and their descriptions.Example Output
Token Scopes
Scopes limit what a token can do. Always use the minimum scopes needed.Scope Combinations
Common scope combinations for different use cases:Using Tokens
Environment Variable
Set theWIT_TOKEN environment variable:
Authorization Header
Use the token in API requests:Git Credential Helper
Configure git to use your token:Security Best Practices
Use short-lived tokens
Use short-lived tokens
Set expiration dates for tokens, especially those used in CI/CD:
Use minimal scopes
Use minimal scopes
Only grant the permissions the token actually needs:
Rotate tokens regularly
Rotate tokens regularly
Create new tokens and revoke old ones periodically:
Never commit tokens
Never commit tokens
Use environment variables or secret management tools instead of hardcoding tokens in code.
Revoke unused tokens
Revoke unused tokens
Regularly audit and revoke tokens that are no longer needed:
Workflow Examples
CI/CD Setup
Automation Script
Token Rotation
Requirements
The token command requires:- Database connection: Set
DATABASE_URLenvironment variable - User authentication: Set
WIT_USER_IDenvironment variable
When using
wit up to start the platform, these are configured automatically. The WIT_USER_ID can be obtained from the web UI after logging in.Related Commands
wit collaborator- Manage repository collaboratorswit up- Start the wit platformwit serve- Start the API server