Authentication Methods
1. Provider-Based Authentication
Meshery uses a provider-based authentication system. Providers handle user authentication, session management, and preferences.Local Provider (Default)
The Local Provider stores data locally and does not require external authentication:Remote Provider (Meshery Cloud)
Remote providers like Meshery Cloud require authentication tokens:2. Session-Based Authentication
After logging in through the Meshery UI, a session cookie is set:3. Token Authentication
For programmatic access, use bearer tokens:Obtaining Authentication Tokens
Meshery Cloud Provider
- Log in to Meshery Cloud
- Navigate to Account Settings > API Tokens
- Generate a new token with appropriate scopes
- Copy the token (it will only be shown once)
Using mesheryctl
The Meshery CLI can generate tokens:Authentication Headers
Required Headers
Bearer token for authentication:
Set to
application/json for JSON payloadsOptional Headers
Unique identifier for request tracing
Provider Selection
Meshery supports multiple providers simultaneously. Specify your provider:Get Available Providers
Set Active Provider
Providers are selected during the login flow through the UI or mesheryctl.Organization ID (orgID)
Many endpoints require anorgID query parameter when using remote providers:
orgID identifies which organization’s resources you’re accessing. You can find your organization ID in Meshery Cloud under Settings > Organization.
Authentication Examples
Example 1: List Workspaces (Local Provider)
Example 2: List Workspaces (Remote Provider)
Example 3: Create Connection
Example 4: GraphQL Query
Error Codes
Authentication Errors
Missing or invalid authentication credentials
Valid credentials but insufficient permissions
Security Best Practices
Token Storage
- Never commit tokens to version control
- Store tokens in environment variables:
- Use secrets management tools (e.g., HashiCorp Vault, AWS Secrets Manager)
Token Rotation
- Rotate tokens regularly (recommended: every 90 days)
- Revoke unused tokens immediately
- Use separate tokens for different applications/environments
Network Security
- Always use HTTPS in production
- Implement TLS/SSL for API endpoints
- Use mutual TLS (mTLS) for service-to-service communication
Testing Authentication
Test your authentication setup:Troubleshooting
”failed to get token”
Ensure you’re including the Authorization header:“orgID is required”
Remote providers require an organization ID:Session Expired
Re-authenticate through the UI or mesheryctl:Next Steps
Workspaces API
Manage workspaces
Connections API
Connect to clusters