<@U04S8PLJWMT> in cdk lowcode how in the access to...
# ask-ai
k
@kapa.ai in cdk lowcode how in the access token part how do i configure to send this in header : {"Content-Type": "application/x-www-form-urlencoded"}
k
To configure the access token request in Airbyte CDK Low-Code to send the header
{"Content-Type": "application/x-www-form-urlencoded"}
, you should use the
refresh_request_headers
property in the
OAuthAuthenticator
section of your YAML manifest. This property allows you to specify custom headers for the token refresh (access token) request. Here’s an example snippet:
Copy code
yaml authenticator:   type: OAuthAuthenticator   # ... other required OAuth properties ...   refresh_request_headers:     Content-Type: "application/x-www-form-urlencoded"
This configuration ensures that when Airbyte sends the request to obtain or refresh the access token, it will include the
Content-Type: application/x-www-form-urlencoded
header as required by many OAuth 2.0 token endpoints. For more details and additional properties you can set in the OAuthAuthenticator, see the official documentation: [OAuthAuthenticator Reference](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/OAuthAuthenticator)
k
So I had this error @kapa.ai "Internal Server Error: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: REDACTED (
StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION
disabled); line: 1, column: 1]" when i tried to use this
Copy code
access_token_headers:
        Content-Type: application/x-www-form-urlencoded
        Authorization: Basic {{ (client_id ~ ':' ~ client_secret) | b64encode }}
        access_token_params: |
          {
            {
            "client_id": "{{ config.client_id }}",
            "client_secret": "{{ config.client_secret }}",
            "code": "{{ auth_code_value }}",
            "grant_type": "authorization_code",
            "redirect_uri": "https://cloud.airbyte.com/auth_flow"
          }
        scope: "task: read"
k
A message from kapa.ai
The error you encountered:
Copy code
Internal Server Error: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
suggests that the response from the token endpoint is not valid JSON—it's likely an HTML error page (often starting with
<html>
), which usually means the request was not formatted as the server expected. Issues in your configuration: 1. YAML Structure: In Airbyte's declarative OAuth spec,
access_token_headers
and
access_token_params
are not nested under each other—they are siblings under the OAuth configuration. Also,
access_token_params
should be a YAML object, not a string or block. 2. Content-Type and Parameter Format: If you set
Content-Type: application/x-www-form-urlencoded
, the parameters must be sent as form data, not as a JSON object. Airbyte's declarative OAuth supports this by default, but you must provide the parameters as a YAML map, not as a stringified JSON. Correct Example:
Copy code
yaml access_token_url: https://yourconnectorservice.com/oauth/token access_token_headers:   Content-Type: application/x-www-form-urlencoded   Authorization: Basic {{ (client_id_value ~ ':' ~ client_secret_value) | b64encode }} access_token_params:   client_id: "{{ client_id_value }}"   client_secret: "{{ client_secret_value }}"   code: "{{ auth_code_value }}"   grant_type: "authorization_code"   redirect_uri: "https://cloud.airbyte.com/auth_flow"   scope: "task: read"
Key Points: -
access_token_params
should be a YAML map, not a string or block. - Do not use double curly braces inside a YAML block for the whole object—use them only for values. - Make sure the endpoint expects form-encoded data if you set the
Content-Type
header accordingly. References: - [Advanced Case: access token url query parameters should be JSON-encoded](https://docs.airbyte.com/platform/connector-development/config-based/advanced-topics/oauth#advanced-case-access-token-url-query-parameters-should-be-json-encoded) - [OAuthAuthenticator Reference](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/OAuthAuthenticator) If you still get an HTML error, double-check the endpoint URL and required parameters, and ensure your client credentials are correct. If the endpoint expects JSON, you may need to adjust the
Content-Type
and parameter formatting accordingly.
k
@kapa.ai recommend me yaml based on this doc : Authorization Get Access Token In order to call TickTick's Open API, it is necessary to obtain an access token for the corresponding user. TickTick uses the OAuth2 protocol to obtain the access token. First Step Redirect the user to the TickTick authorization page, https://ticktick.com/oauth/authorize. The required parameters are as follows: Name Description client_id Application unique id scope Spaces-separated permission scope. The currently available scopes are tasks:write tasks:read state Passed to redirect url as is redirect_uri User-configured redirect url response_type Fixed as code Example: https://ticktick.com/oauth/authorize?scope=scope&client_id=client_id&state=state&redirect_uri=redirect_uri&response_type=code Second Step After the user grants access, TickTick will redirect the user back to your application's
redirect_uri
with an authorization code as a query parameter. Name Description code Authorization code for subsequent access tokens state state parameter passed in the first step Third Step To exchange the authorization code for an access token, make a POST request to
https://ticktick.com/oauth/token
with the following parameters(Content-Type: application/x-www-form-urlencoded): Name Description client_id The username is located in the HEADER using the Basic Auth authentication method client_secret The password is located in the HEADER using the Basic Auth authentication method code The code obtained in the second step grant_type grant type, now only authorization_code scope spaces-separated permission scope. The currently available scopes are tasks: write, tasks: read redirect_uri user-configured redirect url Access_token for openapi request authentication in the request response
Copy code
{  
...  
"access_token": "access token value"  
...  
}
Request OpenAPI Set Authorization in the header, the value is Bearer
access token value
k
A message from kapa.ai
New message text here