AuthorizationProvider
AuthorizationProvider defines how QType components authenticate with external APIs and services. It provides a centralized, reusable way to configure authentication credentials and methods for models, tools, indexes, and other components that need to access external resources.
By centralizing authentication configuration, AuthorizationProvider enables secure credential management, supports multiple authentication methods (API keys, OAuth2, etc.), and allows the same credentials to be reused across multiple components without duplication.
Rules and Behaviors
- Unique IDs: Each authorization provider must have a unique
id
within the application. Duplicate authorization provider IDs will result in a validation error. - Required Type: The
type
field is mandatory and specifies the authentication method (e.g., "api_key", "oauth2"). - Method-Specific Fields: Different authentication types require different field combinations:
- API key authentication: requires
api_key
field - OAuth2 authentication: typically requires
client_id
,client_secret
,token_url
, and optionallyscopes
- Optional Host: The
host
field can specify the base URL or domain of the service provider. - Reference by Components: Can be referenced by Models, Tools, Indexes, and TelemetrySink by ID string or embedded as inline objects.
- Environment Variable Support: Credential fields support environment variable substitution using
${VARIABLE_NAME}
syntax.
AuthorizationProvider
Defines how tools or providers authenticate with APIs, such as OAuth2 or API keys.
- id (
str
): Unique ID of the authorization configuration. - api_key (
str | None
): API key if using token-based auth. - client_id (
str | None
): OAuth2 client ID. - client_secret (
str | None
): OAuth2 client secret. - host (
str | None
): Base URL or domain of the provider. - scopes (
list[str] | None
): OAuth2 scopes required. - token_url (
str | None
): Token endpoint URL. - type (
str
): Authorization method, e.g., 'oauth2' or 'api_key'.
Related Concepts
AuthorizationProvider is referenced by Model, Tool, Index, and other components that need external API access.