Kiet Luu (Ken)
08/22/2025, 3:03 AMstatus_codes_for_ratelimit_hit with a detailed example pleasekapa.ai
08/22/2025, 3:03 AMstatus_codes_for_ratelimit_hit in Airbyte's connector configuration is used to specify which HTTP status codes indicate that your connector has hit an API rate limit. When a response from the API contains one of these status codes, Airbyte will recognize that the rate limit has been exceeded and will automatically pause requests and retry according to the defined rate limiting policy. ### How it works - Purpose: It tells Airbyte which HTTP responses mean "you've hit the rate limit." - Common values: The most typical status code is 429 (Too Many Requests), but some APIs use others like 420 or 503. - Effect: When Airbyte receives a response with a status code listed in status_codes_for_ratelimit_hit, it will handle the situation according to your rate limiting configuration (e.g., wait until the reset time, retry after a delay, etc.). ### Example Suppose you are integrating with an API that uses the following rate limit headers and status codes: - `X-RateLimit-Reset`: Tells you when the rate limit will reset. - `X-RateLimit-Remaining`: Tells you how many requests you have left. - Returns 429 or 420 when the rate limit is hit. You would configure your connector like this: yaml api_budget: type: "HTTPAPIBudget" ratelimit_reset_header: "X-RateLimit-Reset" ratelimit_remaining_header: "X-RateLimit-Remaining" status_codes_for_ratelimit_hit: [429, 420] policies: - type: "FixedWindowCallRatePolicy" period: "PT1H" call_limit: 1000 matchers: - method: "GET" url_base: "https://api.example.com" url_path_pattern: "^/users" What happens: - If the API responds with a 429 or 420 status code, Airbyte will recognize this as a rate limit event. - Airbyte will then use the information from the X-RateLimit-Reset header to determine when it can resume making requests, ensuring you don't get blocked or throttled by the API. This mechanism helps your connector to automatically respect the API's rate limits without manual intervention, making your data syncs more reliable and API-friendly. For more details and examples, see the documentation: [Rate limiting (API Budget)](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/rate-limit-api-budget#putting-it-all-together) and [HTTP API Budget](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/global-configuration#http-api-budget).Kiet Luu (Ken)
08/22/2025, 3:04 AMkapa.ai
08/22/2025, 3:04 AMkapa.ai
08/22/2025, 3:05 AMapi_budget configuration: yaml api_budget: type: HTTPAPIBudget policies: - type: MovingWindowCallRatePolicy rates: - limit: 3 interval: PT1S - limit: 60 interval: PT1M matchers: - method: GET url_path_pattern: .* status_codes_for_ratelimit_hit: - 503 ### Scenarios from this configuration 1. Rate Limiting Rules: - For any GET request (to any path, due to url_path_pattern: .*), the following limits apply: - No more than 3 requests in any 1-second window. - No more than 60 requests in any 1-minute window. - These are enforced as a moving (sliding) window, meaning Airbyte tracks the number of requests in the most recent 1 second and 1 minute, not just by fixed clock intervals. If either limit is exceeded, further requests will be paused until the window allows more requests again [Rate Policies - Moving Window Call Rate Policy](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/rate-limit-api-budget#rate-policies). 2. Rate Limit Hit Detection: - If the API responds with a 503 status code, Airbyte will interpret this as a rate limit has been hit (even though 503 is typically "Service Unavailable," your config treats it as a rate limit signal). - When this happens, Airbyte will pause further requests and retry according to the rate limiting policy [HTTP API Budget](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/global-configuration#http-api-budget). 3. Combined Enforcement: - Both rate limits (per second and per minute) are enforced together. If you exceed either, requests will be throttled. - For example, if you send 4 requests in 1 second, the 4th will be delayed until the 1-second window allows it. If you send 61 requests in 1 minute, the 61st will be delayed until the 1-minute window allows it. 4. No Other Methods or Paths: - Only GET requests are affected. Other HTTP methods (POST, PUT, etc.) are not rate-limited by this policy. ### Summary Table | Scenario | What happens? | |-------------------------------------------|-----------------------------------------------| | ≤3 GET requests in 1 second | All requests proceed | | >3 GET requests in 1 second | Excess requests are delayed | | ≤60 GET requests in 1 minute | All requests proceed | | >60 GET requests in 1 minute | Excess requests are delayed | | API returns 503 for a GET request | Airbyte pauses and retries per policy | | Non-GET request | Not rate-limited by this policy | If you need to handle other status codes or methods, you would need to adjust the configuration accordingly. References: - [Rate limiting (API Budget) - Moving Window Call Rate Policy](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/rate-limit-api-budget#rate-policies) - [HTTP API Budget - Status Codes for Rate Limit Hit](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/global-configuration#http-api-budget)Kiet Luu (Ken)
08/22/2025, 3:08 AMkapa.ai
08/22/2025, 3:08 AMkapa.ai
08/22/2025, 3:08 AMstatus_codes_for_ratelimit_hit, Airbyte will treat 503 as a rate limit event and apply the rate limiting policy as well, pausing and retrying according to your API budget configuration. Summary: When a 503 is received, Airbyte will both: - Apply the rate limiting policy (pause requests as needed). - Retry the request up to 5 times with exponential backoff, unless you override this behavior. This is confirmed in the documentation: > When an error handler is not configured for a stream, the connector will default to retrying requests that received a 429 and 5XX status code in the response 5 times using a 5-second exponential backoff. This default retry behavior is recommended if the API documentation does not specify error handling or retry behavior. [Error Handling - Connector Builder UI](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/error-handling) [HTTP API Budget](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/global-configuration#http-api-budget)Kiet Luu (Ken)
08/22/2025, 3:09 AMkapa.ai
08/22/2025, 3:09 AMkapa.ai
08/22/2025, 3:09 AMstatus_codes_for_ratelimit_hit parameter, Airbyte will use its default value, which is [429]. This means only HTTP 429 responses ("Too Many Requests") will be interpreted as a rate limit hit. If your API uses other status codes (like 503 or 420) to indicate rate limiting, Airbyte will not recognize those as rate limit events, and may not pause or retry appropriately, potentially leading to failed syncs or being blocked by the API. If you add or modify the status_codes_for_ratelimit_hit parameter, you can specify additional or different status codes that your API uses to signal rate limiting (e.g., [429, 420, 503]). This ensures Airbyte will correctly interpret those responses as rate limit hits, pause requests, and retry according to your rate limiting policy. If you add codes that are not actually used for rate limiting by your API, Airbyte may unnecessarily pause or delay requests when those codes are encountered. In summary: - Removing the parameter limits detection to the default (429), which may not cover all your API's rate limit signals. - Adding/modifying the parameter allows you to tailor rate limit detection to your API, improving reliability and compliance with the API's requirements. This behavior is described in the documentation: > Configure which HTTP status codes indicate that a rate limit has been exceeded. The most common is 429 Too Many Requests, but some APIs use other codes like 420 or 503. When these status codes are encountered, the connector will automatically pause requests and retry according to the rate limiting policy. [HTTP API Budget](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/global-configuration#http-api-budget) The default value is also documented: > status_codes_for_ratelimit_hit: > type: array > default: [429] > ... [Rate limiting (API Budget)](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/rate-limit-api-budget)Kiet Luu (Ken)
08/22/2025, 3:10 AMkapa.ai
08/22/2025, 3:10 AMkapa.ai
08/22/2025, 3:10 AMstatus_codes_for_ratelimit_hit is set to [503], only HTTP 503 responses will be treated as a rate limit hit by the API budget policy. This means: - A 429 response will not trigger your API budget policy (i.e., Airbyte will not pause or apply the rate limiting logic you defined for 429). - However, 429 is still a 5XX/4XX error, so Airbyte’s default retry mechanism will apply: it will retry the request up to 5 times with exponential backoff, but it will not use your custom rate limiting policy for 429 unless you explicitly include 429 in status_codes_for_ratelimit_hit [Rate limiting (API Budget)](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/rate-limit-api-budget) [HTTP API Budget](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/global-configuration#http-api-budget). Summary: - 503: Triggers both your API budget policy and default retry. - 429: Only triggers default retry, not your API budget policy. If you want 429 responses to also trigger your API budget policy, you should add 429 to the status_codes_for_ratelimit_hit array.Kiet Luu (Ken)
08/22/2025, 3:11 AMkapa.ai
08/22/2025, 3:11 AMkapa.ai
08/22/2025, 3:11 AMstatus_codes_for_ratelimit_hit parameter. - If you set status_codes_for_ratelimit_hit: [503], only a 503 response will trigger the rate limit handling logic (pausing, waiting for reset, etc.), regardless of what your matcher covers. - If you receive a 429 response, it will not trigger the rate limit handling logic defined in your API budget policy, even though the matcher covers all GET requests. The 429 will only be retried according to Airbyte's default retry mechanism, not your custom rate limiting policy. So, the matcher defines which requests the policy applies to, but the status_codes_for_ratelimit_hit defines which responses are interpreted as a rate limit event. Both must align with your API's actual behavior for the policy to work as intended. If you want 429 responses to also trigger your rate limit handling, you must add 429 to `status_codes_for_ratelimit_hit`: yaml status_codes_for_ratelimit_hit: - 503 - 429 This is confirmed in the documentation: > Configure which HTTP status codes indicate that a rate limit has been exceeded. The most common is 429 Too Many Requests, but some APIs use other codes like 420 or 503. When these status codes are encountered, the connector will automatically pause requests and retry according to the rate limiting policy. [HTTP API Budget](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/global-configuration#http-api-budget) So, the matcher and the status code work together, but both must be set correctly for your policy to apply to the right requests and responses.Kiet Luu (Ken)
08/22/2025, 10:43 AMkapa.ai
08/22/2025, 10:43 AMkapa.ai
08/22/2025, 10:44 AMapi_budget policy (such as the 60 requests per minute limit) is defined at the connector (source) configuration level. Each source connection in Airbyte is configured independently, with its own YAML configuration and rate limit policy. If you set up two separate source connections for two different clients, even if both point to the same API URL, each connection will have its own independent rate limit budget and enforcement. The rate limiting is not shared or enforced globally across all connections using the same source definition; it is enforced per connection instance. This means: - Each connection will be allowed up to 60 requests per minute, independently of the other. - If both connections are running at the same time, you could potentially make up to 120 requests per minute to the same API (60 from each connection). The documentation describes the API budget as part of the connector configuration, and there is no mention of global or cross-connection enforcement of rate limits. Each connection's policy is applied to the requests made by that specific connection only [Rate limiting (API Budget)](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/rate-limit-api-budget). If you need to enforce a global rate limit across multiple connections, you would need to implement that outside of Airbyte, as the platform does not provide a built-in mechanism for global rate limit sharing across connections.Kiet Luu (Ken)
08/22/2025, 10:44 AMkapa.ai
08/22/2025, 10:44 AMkapa.ai
08/22/2025, 10:44 AM--low-resource-mode flag. This is explicitly stated in the documentation: > If you install Airbyte with abctl using low-resource mode, you are unable to access the Connector Builder. To access the Connector Builder, allocate Airbyte's suggested resources and re-deploy Airbyte without setting the --low-resource-mode flag [Connector Builder UI Overview](https://docs.airbyte.com/platform/1.7/connector-development/connector-builder-ui/overview). Additionally, release notes confirm that the Connector Builder is off in low resource mode, and there is no mention of an alternative method for importing custom YAML connectors in this mode [Release Notes v1.7](https://docs.airbyte.com/release_notes/v-1.7#connector-builder-off-in-low-resource-mode).Kiet Luu (Ken)
08/22/2025, 12:39 PMclient_access_token is provided in the config.
# - If YES (for PyAirbyte), it uses the simple BearerHeaderAuthenticator.
# - If NO (for Airbyte Platform), it uses the full OAuthAuthenticator for the UI flow.
conditional_authenticator:
{% if config['client_access_token'] %}
type: BearerHeaderAuthenticator
api_token: "{{ config['client_access_token'] }}"
{% else %}
type: OAuthAuthenticator
scopes:
- "tasks:read"
client_id: "{{ config['client_id'] }}"
grant_type: client_credentials
client_secret: "{{ config['client_secret'] }}"
access_token_value: "{{ config['client_access_token'] }}"
{% endif %}
streams:
projects:
type: DeclarativeStream
name: projects
primary_key:
- id
retriever:
type: SimpleRetriever
requester:
type: HttpRequester
path: /open/v1/project/
url_base: https://api.ticktick.com
# We now reference the conditional authenticator here.
authenticator:
$ref: "#/definitions/conditional_authenticator"
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path: []
record_filter:
type: RecordFilter
condition: "{{ not record.closed }}"
schema_loader:
type: InlineSchemaLoader
schema:
type: object
$schema: http://json-schema.org/schema#
required: [ "id" ]
properties:
id: { type: string }
kind: { type: [ "string", "null" ] }
name: { type: [ "string", "null" ] }
color: { type: [ "string", "null" ] }
closed: { type: [ "boolean", "null" ] }
groupId: { type: [ "string", "null" ] }
viewMode: { type: [ "string", "null" ] }
sortOrder: { type: [ "number", "null" ] }
permission: { type: [ "string", "null" ] }
tasks:
type: DeclarativeStream
name: tasks
primary_key:
- id
retriever:
type: SimpleRetriever
requester:
type: HttpRequester
path: /open/v1/project/{{ stream_partition['parent_id'] }}/data
url_base: https://api.ticktick.com
http_method: GET
# We also reference the conditional authenticator here.
authenticator:
$ref: "#/definitions/conditional_authenticator"
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path: [ tasks ]
partition_router:
type: SubstreamPartitionRouter
parent_stream_configs:
- type: ParentStreamConfig
stream:
$ref: "#/definitions/streams/projects"
parent_key: id
partition_field: parent_id
schema_loader:
type: InlineSchemaLoader
schema:
type: object
$schema: http://json-schema.org/schema#
required: [ "id" ]
properties:
id: { type: string }
title: { type: [ "string", "null" ] }
projectId: { type: [ "string", "null" ] }
content: { type: [ "string", "null" ] }
desc: { type: [ "string", "null" ] }
status: { type: [ "number", "null" ] }
priority: { type: [ "number", "null" ] }
sortOrder: { type: [ "number", "null" ] }
timeZone: { type: [ "string", "null" ] }
isAllDay: { type: [ "boolean", "null" ] }
startDate: { type: [ "string", "null" ] }
dueDate: { type: [ "string", "null" ] }
repeatFlag: { type: [ "string", "null" ] }
tags: { type: [ "array", "null" ], items: { type: [ "string", "null" ] } }
otherwise is it possible for conntector to have 2 options to authenticate ? one oauth and one directly through access token key user provided. so use case is my original connector uses oauth and is not compatible with pyairbytekapa.ai
08/22/2025, 12:39 PMkapa.ai
08/22/2025, 12:39 PM{{ config['client_access_token'] }}), but it does not support full Jinja2 control flow (like {% if ... %} ... {% else %} ... {% endif %}) in the YAML manifest. The documentation only mentions variable interpolation, not conditional blocks or logic statements. Supported usage is for in-line value substitution, not for controlling YAML structure or which blocks are included or excluded at runtime [Commonly used Jinja2 in-variables interpolation methods](https://docs.airbyte.com/platform/next/connector-development/config-based/advanced-topics/oauth#commonly-used-jinja2-in-variables-interpolation-methods-available-the-list-is-not-exhaustive). ### 2. Can a connector support two authentication options (OAuth and direct access token)? Yes, you can support multiple authentication methods, but not with Jinja2 control flow. Airbyte provides a feature called [Selective Authenticator](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#selective-authenticator), which allows you to define multiple authentication methods and select between them based on a configuration property. This is the recommended way to let users choose between OAuth and a direct access token. Example approach: - Define a configuration property (e.g., auth_type) where the user selects "oauth" or "access_token". - Use the Selective Authenticator to choose the appropriate authentication method based on this property. > Selective Authenticator allows you to dynamically choose between different authentication methods based on a configuration property value. This is useful when your connector needs to support multiple authentication options and let users select which one to use. [Selective Authenticator](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#selective-authenticator) Note: Selective Authenticator is not well-supported in the UI and requires editing the YAML directly. --- Summary: - Jinja2 control flow (if/else) is not supported in Airbyte YAML specs. - To support both OAuth and direct access token authentication, use the Selective Authenticator pattern, not Jinja2 logic blocks.Kiet Luu (Ken)
08/22/2025, 12:44 PMkapa.ai
08/22/2025, 12:44 PMkapa.ai
08/22/2025, 12:44 PMpredicate and an array of authenticators is not supported according to the official documentation. The correct way is to use the SelectiveAuthenticator object, which selects the authenticator based on a configuration property path, not a predicate. You define a config property (e.g., auth_method), and then map possible values to authenticators in the authenticators object. Here’s how it should look: yaml authenticator: type: SelectiveAuthenticator authenticator_selection_path: - auth_method authenticators: Token: type: BearerAuthenticator api_token: "{{ config['client_access_token'] }}" OAuth: type: OAuthAuthenticator scopes: - "tasks:read" client_id: "{{ config['client_id'] }}" grant_type: client_credentials client_secret: "{{ config['client_secret'] }}" access_token_value: "{{ config['client_access_token'] }}" - authenticator_selection_path points to the config property (e.g., auth_method) that the user sets to either "Token" or "OAuth". - The authenticators object maps each possible value to its authenticator definition. This pattern is documented in the Airbyte YAML reference and Selective Authenticator documentation. There is no mention of a predicate field or array-based selection in the official sources [SelectiveAuthenticator YAML Reference](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SelectiveAuthenticator) [Selective Authenticator UI](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#selective-authenticator). Summary: - Do not use predicate or an array for authenticators. - Use authenticator_selection_path and an authenticators object as shown above.Kiet Luu (Ken)
08/22/2025, 1:20 PMkapa.ai
08/22/2025, 1:20 PMkapa.ai
08/22/2025, 1:21 PMconnection_specification is defined. ### Key Issues 1. Missing auth_method in `connection_specification`: - Your SelectiveAuthenticator uses authenticator_selection_path: [auth_method], which means it expects a property called auth_method in the connector configuration to determine which authentication method to use. - However, your connection_specification does not define an auth_method property. As a result, the builder cannot find this property and cannot select between Oauth and Token. When the selection property is missing, the builder will default to the first authenticator listed (in your case, Oauth), which is why it always falls back to OAuth. 2. Case Sensitivity in Authenticator Keys: - The values in your authenticators object (Oauth and Token) must match exactly the value provided in the config property (auth_method). If you add auth_method to your spec, ensure the values match the keys in the authenticators object. ### How to Fix - Add auth_method to your connection_specification so users can select the authentication method: yaml connection_specification: type: object $schema: http://json-schema.org/draft-07/schema# required: - auth_method - client_id - client_secret properties: auth_method: type: string title: Authentication Method enum: [Oauth, Token] description: Select 'Oauth' for OAuth2.0 or 'Token' for direct access token authentication. client_id: type: string order: 0 title: Client ID airbyte_secret: true client_secret: type: string order: 1 title: Client secret airbyte_secret: true client_access_token: type: string order: 2 title: Access token airbyte_secret: true api_key: type: string order: 3 title: API Key airbyte_secret: true additionalProperties: true - Ensure the user sets auth_method to either Oauth or Token when configuring the source. - Check that the keys in authenticators match the possible values of auth_method exactly (case-sensitive). ### Reference This approach is based on the official documentation for [SelectiveAuthenticator](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SelectiveAuthenticator), which states: > Authenticator that selects concrete authenticator based on config property. > Path of the field in config with selected authenticator name... If the property is missing, the selection cannot occur, and the default/fallback behavior is used. --- Summary: The conflict is that your config expects an auth_method property for authentication selection, but your spec does not define it. Add auth_method to your connection_specification and ensure its values match your authenticator keys. This will allow the builder to parse the selector and choose the correct authentication method.Kiet Luu (Ken)
08/22/2025, 1:31 PMkapa.ai
08/22/2025, 1:31 PMkapa.ai
08/22/2025, 1:31 PMclient_id and client_secret are required only when auth_method is "Oauth", and client_access_token is required only when auth_method is `"Token"`—you should use the oneOf keyword in your JSON Schema. This is the recommended approach in Airbyte for conditional requirements, as described in the documentation on using oneOf for mutually exclusive options [Using oneOf](https://docs.airbyte.com/platform/next/connector-development/connector-specification-reference#using-oneof). Here’s how you can structure your `connection_specification`: yaml connection_specification: type: object $schema: http://json-schema.org/draft-07/schema# properties: auth_method: type: string title: Authentication Method enum: [Oauth, Token] description: Select 'Oauth' for OAuth2.0 or 'Token' for direct access token authentication. client_id: type: string order: 0 title: Client ID airbyte_secret: true client_secret: type: string order: 1 title: Client secret airbyte_secret: true client_access_token: type: string order: 2 title: Access token airbyte_secret: true required: - auth_method oneOf: - required: [auth_method, client_id, client_secret] properties: auth_method: const: Oauth - required: [auth_method, client_access_token] properties: auth_method: const: Token additionalProperties: true How this works: - If auth_method is "Oauth", then client_id and client_secret are required. - If auth_method is "Token", then client_access_token is required. This pattern is supported by Airbyte and will be rendered correctly in the UI, enforcing the correct required fields based on the user's selection [Using oneOf](https://docs.airbyte.com/platform/next/connector-development/connector-specification-reference#using-oneof).Kiet Luu (Ken)
08/22/2025, 1:48 PMkapa.ai
08/22/2025, 1:48 PMkapa.ai
08/22/2025, 1:48 PMauth_method and credentials.oneOf In your schema, the auth_method property is separate from the credentials object, and there is no explicit link between the value of auth_method and which oneOf branch in credentials should be used. Airbyte's UI and validation expect the mutually exclusive options to be tied together, typically by using a const property inside each oneOf branch that matches the selection field (see the [official pattern for using oneOf](https://docs.airbyte.com/platform/next/connector-development/connector-specification-reference#using-oneof)). 2. Incorrect required Syntax in Second Branch In your second oneOf branch, you have: yaml required: client_access_token This should be: yaml required: - client_access_token 3. Best Practice: Use a Discriminator Field The recommended pattern is to have a single object (e.g., credentials) with a field (e.g., auth_method or option_title) that is a const in each oneOf branch. This way, the UI and validator know which branch to use based on the value of that field. This is shown in the Airbyte documentation example: yaml "oneOf": [ { "required": ["option_title", "client_id", "client_secret"], "properties": { "option_title": { "type": "string", "const": "Oauth" }, ... } }, { "required": ["option_title", "client_access_token"], "properties": { "option_title": { "type": "string", "const": "Token" }, ... } } ] This pattern ensures the UI and validation logic can correctly enforce which fields are required based on the user's selection [Using oneOf](https://docs.airbyte.com/platform/next/connector-development/connector-specification-reference#using-oneof). Summary: - Your schema does not explicitly connect auth_method to the correct oneOf branch in credentials. - The required field in the second branch is not in array form. - The recommended approach is to use a discriminator field (like option_title) inside the oneOf branches, not a separate top-level property. For Airbyte compatibility, follow the documented pattern for oneOf with a discriminator field inside the object.Kiet Luu (Ken)
08/22/2025, 1:50 PMkapa.ai
08/22/2025, 1:50 PMkapa.ai
08/22/2025, 1:51 PMoneOf, here is a YAML snippet for your connection_specification that ties the authentication method to the required fields using a discriminator field (e.g., auth_method). This ensures the UI and validation logic enforce the correct required fields based on the user's selection: yaml connection_specification: type: object $schema: http://json-schema.org/draft-07/schema# required: - credentials properties: credentials: type: object title: Authentication oneOf: - title: OAuth2.0 required: [auth_method, client_id, client_secret] properties: auth_method: type: string const: Oauth title: Authentication Method description: Use OAuth2.0 authentication. client_id: type: string title: Client ID airbyte_secret: true client_secret: type: string title: Client Secret airbyte_secret: true client_access_token: type: string title: Access Token (optional) airbyte_secret: true - title: Access Token required: [auth_method, client_access_token] properties: auth_method: type: string const: Token title: Authentication Method description: Use a direct access token. client_access_token: type: string title: Access Token airbyte_secret: true additionalProperties: true How this works: - The user selects the authentication method by setting credentials.auth_method to either "Oauth" or "Token". - If "Oauth" is selected, client_id and client_secret are required. - If "Token" is selected, only client_access_token is required. This pattern is directly aligned with Airbyte’s documentation for using oneOf with a discriminator field to enforce mutually exclusive required fields in the UI and validation logic [Using oneOf](https://docs.airbyte.com/platform/next/connector-development/connector-specification-reference#using-oneof). If you need the auth_method at the top level instead of inside credentials, you can adapt the pattern, but the key is that the discriminator field (auth_method) must be present and have a const value in each oneOf branch.Kiet Luu (Ken)
08/22/2025, 1:55 PMkapa.ai
08/22/2025, 1:55 PMkapa.ai
08/22/2025, 1:56 PMadvanced_auth spec and the base_requester definition, here’s what stands out: ### 1. Mismatch in Config Path for OAuth Fields Your advanced_auth spec expects the OAuth fields (client_id, client_secret, client_access_token) to be at the top level of the config (e.g., config["client_id"]). - In your SelectiveAuthenticator, you reference these fields as config["client_id"], config["client_secret"], and config["client_access_token"], which matches the expectation of the advanced_auth spec. If your connection spec uses a nested structure (e.g., credentials.client_id), you must update both the advanced_auth paths and the authenticator references to match. If you use a flat structure, your current setup is correct. ### 2. auth_method Property Your authenticator_selection_path is set to ["auth_method"]. - Ensure that your connection_specification includes an auth_method property at the top level, and that its value matches the keys in your authenticators mapping (Oauth and Token). If you use a nested structure (e.g., credentials.auth_method), update the path accordingly. ### 3. OAuthAuthenticator grant_type Your OAuthAuthenticator uses grant_type: client_credentials, but your advanced_auth spec and OAuth flow (with authorization_code in access_token_params) suggest you are using the Authorization Code flow, not Client Credentials. - Make sure the grant_type in your authenticator matches the flow you are actually using. ### 4. Scopes Formatting Your scopes in the authenticator are: yaml scopes: - "tasks:" - read This may be a typo; typically, scopes are a single string or a list of strings, e.g., "tasks:read". ### 5. No Reference to advanced_auth in base_requester There is no explicit reference needed from base_requester to `advanced_auth`—the platform uses advanced_auth to drive the UI and OAuth flow, and the authenticator in your requester uses the config values. However, if your config structure does not match what advanced_auth expects, the OAuth flow may not work as intended. --- Summary of what to check or fix: - Ensure your config structure (flat vs. nested) matches between advanced_auth, base_requester, and connection_specification. - Make sure auth_method is present and matches the keys in your authenticators. - Align the grant_type in your authenticator with your OAuth flow. - Correct the scopes formatting if needed. If you follow these points and your config structure is consistent, your setup should work as intended. If you still encounter issues, please provide your connection_specification so the config paths can be verified in detail. > The knowledge sources do not provide a direct example of combining advanced_auth with a SelectiveAuthenticator, but the above points are based on the documented structure and requirements for each component [SelectiveAuthenticator YAML Reference](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SelectiveAuthenticator).Kiet Luu (Ken)
08/22/2025, 1:58 PMkapa.ai
08/22/2025, 1:58 PMkapa.ai
08/22/2025, 1:59 PMclient_id, client_secret, client_access_token, and auth_method are all at the top level), which matches the expectations of both advanced_auth and the `SelectiveAuthenticator`: yaml connection_specification: type: object $schema: http://json-schema.org/draft-07/schema# required: - auth_method properties: auth_method: type: string title: Authentication Method enum: [Oauth, Token] description: Select 'Oauth' for OAuth2.0 or 'Token' for direct access token authentication. client_id: type: string title: Client ID airbyte_secret: true client_secret: type: string title: Client Secret airbyte_secret: true client_access_token: type: string title: Access Token airbyte_secret: true oneOf: - required: [auth_method, client_id, client_secret] properties: auth_method: const: Oauth - required: [auth_method, client_access_token] properties: auth_method: const: Token additionalProperties: true spec: type: Spec advanced_auth: auth_flow_type: oauth2.0 oauth_config_specification: complete_oauth_output_specification: required: - access_token properties: access_token: type: string path_in_connector_config: - client_access_token oauth_connector_input_specification: scope: "tasks:read" consent_url: >- https://ticktick.com/oauth/authorize?scope={{scope_value | urlEncode}}&client_id={{client_id_value}}&state={{state}}&redirect_uri={{redirect_uri_value}}&response_type=code extract_output: - access_token access_token_url: https://ticktick.com/oauth/token access_token_params: code: "{{ auth_code_value }}" scope: "{{ scope_value | urlEncode }}" grant_type: authorization_code redirect_uri: "{{ redirect_uri_value }}" access_token_headers: Content-Type: application/x-www-form-urlencoded Authorization: >- Basic {{ (client_id_value ~ ':' ~ client_secret_value) | b64encode }} complete_oauth_server_input_specification: required: - client_id - client_secret properties: client_id: type: string client_secret: type: string complete_oauth_server_output_specification: required: - client_id - client_secret properties: client_id: type: string path_in_connector_config: - client_id client_secret: type: string path_in_connector_config: - client_secret definitions: base_requester: type: HttpRequester url_base: https://api.ticktick.com authenticator: type: SelectiveAuthenticator authenticator_selection_path: - auth_method authenticators: Oauth: type: OAuthAuthenticator scopes: - "tasks:read" client_id: "{{ config['client_id'] }}" grant_type: authorization_code client_secret: "{{ config['client_secret'] }}" access_token_value: "{{ config['client_access_token'] }}" Token: type: BearerAuthenticator api_token: "{{ config['client_access_token'] }}" error_handler: type: DefaultErrorHandler Key points: - The auth_method property controls which authentication method is used. - The oneOf block ensures the correct fields are required based on the selected method. - The SelectiveAuthenticator references the same auth_method and uses the correct config paths. - The advanced_auth block is aligned with the flat config structure and OAuth flow. This structure is directly supported by Airbyte and follows the documented best practices for conditional authentication and OAuth configuration [Using oneOf](https://docs.airbyte.com/platform/next/connector-development/connector-specification-reference#using-oneof) [SelectiveAuthenticator YAML Reference](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/SelectiveAuthenticator).