DefaultSnykAuth
Default authentication provider for Snyk API.
Overview
This class provides automatic configuration for Snyk API authentication using the clearskies dependency injection system. It is auto-imported when the clearskies_snyk package is used, making authentication configuration seamless.
The authentication can be configured in two ways:
Secret Path (recommended for production): Set the
SNYK_AUTH_SECRET_PATHenvironment variable to point to a secret manager path containing the API key.Direct Environment Key: Set the
SNYK_AUTH_KEYenvironment variable directly with the Snyk API key.
import clearskies
from clearskies_snyk.models import SnykOrg
# The authentication is automatically configured via environment variables
# Option 1: Using secret path
# export SNYK_AUTH_SECRET_PATH=/path/to/secret
# Option 2: Using direct key
# export SNYK_AUTH_KEY=your-api-key
# Then use models normally - auth is handled automatically
orgs = SnykOrg()
for org in orgs:
print(org.name)