MTA
10/03/2025, 8:22 AMkapa.ai
10/03/2025, 8:22 AMclient_id and client_secret. Airbyte’s Declarative OAuth Connector Specification is designed to be flexible and allows you to inject custom parameters into the OAuth flow without writing code. How to add a custom parameter (like id) in Airbyte Cloud UI: When configuring OAuth2 in the Connector Builder UI, you can use the "Declarative OAuth Connector Specification" to define custom parameters for the token exchange step. Specifically, you can add extra fields to the access token request, such as custom query parameters or headers. - In the OAuth2 configuration section, look for options like Access Token Headers and Access Token Query Params (Json Encoded). These allow you to specify additional parameters that should be included when exchanging the authorization code for an access token. - For example, you can add your custom id parameter as a query parameter or in the request body, depending on what the API expects. Here’s what the documentation says: > The best way to implement OAuth is to enable Declarative OAuth Connector Specification. ... You can also configure these optional fields if they're required by the source. > > - Access Token Headers: ... optional headers to inject while exchanging the auth_code to access_token ... > - Access Token Query Params (Json Encoded): ... optional query parameters to inject while exchanging the auth_code to access_token ... > - ... [other overrides for custom parameter names] ... > > [See more details in the official docs.](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#oauth-2) Summary: You do not need to use the CDK for this use case. In the Connector Builder UI, use the Declarative OAuth options to add your custom parameter (id) to the token request. This approach is maintainable and does not require code changes. If you need to inject the parameter in a very custom way (e.g., in a non-standard location), Airbyte’s declarative OAuth also supports custom parameter injection via configuration, making it suitable for most use cases without code changes. If you have trouble finding the exact field in the UI, refer to the "Access Token Query Params" or "Access Token Headers" options in the OAuth2 configuration section of the Connector Builder UI. Let me know if you need step-by-step guidance for your specific API!MTA
10/03/2025, 9:08 AMkapa.ai
10/03/2025, 9:09 AMkapa.ai
10/03/2025, 9:09 AMid) as an input in the Airbyte Connector Builder UI for OAuth2, you should follow these steps: 1. Add the extra parameter as a user input: - Go to the Inputs section of your connector in the Builder UI. - Click Add new user input. - Set the Input name to something like "ID". - Set the Field ID to id. - Set the Type to "String". - Mark it as Required if needed. - Click Create. This will make id available as {{ config['id'] }} in your connector configuration. 2. Inject the extra parameter into the OAuth flow: - In the OAuth2 configuration, when specifying the Access Token Params (or similar field for the token request body), add your custom parameter using the template variable. For example: yaml access_token_params: client_id: "{{ client_id_value }}" client_secret: "{{ client_secret_value }}" id: "{{ config['id'] }}" redirect_uri: "{{ redirect_uri_value }}" code: "{{ auth_code_value }}" This will ensure that the id parameter, as provided by the user, is included in the body of the access token request. Note: - The Access Token Headers section is for HTTP headers, not for request body or query parameters. If your API requires the id in the body or as a query parameter, use Access Token Params instead. - The template variable for your custom input will be {{ config['id'] }}. Reference: This approach is supported by Airbyte’s declarative OAuth, which allows you to add custom parameters to the token request by defining them in the configuration, and user inputs can be referenced using the {{ config['your_field_id'] }} syntax. See the [official documentation for advanced OAuth configuration](https://docs.airbyte.com/platform/connector-development/config-based/advanced-topics/oauth#advanced-case-access-token-url-query-parameters-should-be-json-encoded) for an example of adding custom parameters to the access token request. If you need to encode values (e.g., base64), Airbyte supports template variables, but the documentation does not specify support for inline encoding functions like base64Encoder in the declarative YAML. If you need to encode a value, you may need to pre-encode it or check if the UI supports such a function. Summary: - Add your extra parameter as a user input. - Reference it in the OAuth configuration using {{ config['id'] }} in the appropriate section (usually access_token_params). - Do not use the Headers section unless the API expects the value in an HTTP header. If you need more specific guidance for your API’s requirements, please provide details on where the id parameter needs to be sent (body, query, or header).MTA
10/03/2025, 9:31 AMkapa.ai
10/03/2025, 9:31 AMkapa.ai
10/03/2025, 9:31 AMjson { "client_id": "{{ client_id_value }}", "client_secret": "{{ client_secret_value }}", "site_id": "{{ config['site_id'] }}" } - The keys (client_id, client_secret, site_id) should be plain strings matching what the API expects. - The values can use Jinja templating to inject the actual values from your configuration. Why your approach failed: You used {{ client_id }} and similar expressions as keys, which would result in the actual key names being {{ client_id }} instead of client_id. Most APIs expect the key to be exactly client_id, not a template string. Reference: > Use the access_token_params property to include the JSON-encoded params in the body of the request. > Example rendered access_token_params > > { > "client_id": "YOUR_CLIENT_ID_123", > "client_secret": "YOUR_CLIENT_SECRET_123", > "redirect_uri": "https://cloud.airbyte.com" > } > [See documentation for details.](https://docs.airbyte.com/platform/connector-development/config-based/advanced-topics/oauth#advanced-case-access-token-url-query-parameters-should-be-json-encoded) Action: Update your configuration to use plain string keys as shown above. This should resolve the 401 error if the credentials and parameters are otherwise correct. If you continue to receive a 401 error, double-check that: - The values for client_id, client_secret, and site_id are correct. - The API expects these parameters in the body as JSON (not as query parameters or headers). If the API expects these as query parameters, you may need to use a different configuration field. The documentation above is for JSON-encoded body parameters, which is the most common pattern for OAuth2 token requests.