Overview
The BudClient supports multiple authentication methods for different deployment scenarios.Authentication Methods
1. API Key (Recommended)
Most common method for production applications:2. JWT Token
For server-to-server authentication:3. Dapr Token
For services running in Dapr-enabled environments:4. CLI Stored Credentials
After logging in with the CLI, credentials are stored locally:5. Custom Base URL
For self-hosted or custom deployments:Environment Variables
The SDK recognizes these environment variables:| Variable | Description | Example |
|---|---|---|
BUD_API_KEY | Your API key | bud_abc123... |
BUD_BASE_URL | Custom API endpoint | https://api.example.com |
BUD_JWT_TOKEN | JWT authentication token | eyJhbGc... |
BUD_DAPR_TOKEN | Dapr authentication token | dapr_xyz... |
CLI Authentication
Login
Authenticate via CLI:Check Status
Verify your authentication status:Logout
Remove stored credentials:Security Best Practices
Use Environment Variables
Use Environment Variables
Store API keys in environment variables instead of hardcoding them:
Use .env Files for Development
Use .env Files for Development
Use python-dotenv for local development:
Rotate Keys Regularly
Rotate Keys Regularly
Regularly rotate your API keys from the Bud platform dashboard.
Use Different Keys per Environment
Use Different Keys per Environment
Maintain separate API keys for development, staging, and production.
Example: Multi-Environment Setup
Troubleshooting
Authentication Failed
Authentication Failed
If you receive authentication errors:
- Verify your API key is correct
- Check that the key hasn’t expired
- Ensure you’re using the correct base URL
- Try logging in again with
bud auth login
Module Not Found
Module Not Found
If Python can’t find the
bud module: