<@U04S8PLJWMT> I need to add a customized header p...
# replication-ask-ai
q
@kapa.ai I need to add a customized header parameter to an OAuth2.0 token request. This is using client credentials grant type. Should I add this in the Refresh Request Headers section? Additionally, in that parameter I need to base64 encode a string. Is there a function or other way to do that in that config field or do I need to do the encoding separately? The string to be encoded will be the same for all requests.
k
Adding Custom Headers to OAuth2.0 Token Requests Where to Add the Header Yes, Refresh Request Headers is the correct place to add custom headers for the token request. In the YAML config, this corresponds to the
refresh_request_headers
field on the
OAuthAuthenticator
. [YAML Reference] Base64 Encoding You do not need to encode the string separately. Airbyte's declarative OAuth supports a
b64encode
pipe/filter function directly within the template interpolation syntax. [Template Variables] For example, to base64-encode a static string:
Copy code
refresh_request_headers:
  Authorization: "Basic {{ 'your_static_string_here' | b64encode }}"
  Content-Type: "application/x-www-form-urlencoded"
Or, if the string is a combination of your client ID and secret (a common pattern):
Copy code
refresh_request_headers:
  Authorization: "Basic {{ (config['client_id'] ~ ':' ~ config['client_secret']) | b64encode }}"
  Content-Type: "application/x-www-form-urlencoded"
This pattern is used in real connectors — for example, the Airtable and Gong connectors both use this approach: [Airtable manifest] [Gong manifest]
Copy code
refresh_request_headers:
  Authorization: "Basic {{ [config['credentials']['client_id'], config['credentials']['client_secret']] | join(':') | base64encode }}"
  Content-Type: "application/x-www-form-urlencoded"
> Note: Both
b64encode
and
base64encode
appear in the examples in the knowledge sources — use whichever is consistent with your CDK version. Since your string is the same for all requests, you can simply hardcode it as a literal string in the template:
Copy code
refresh_request_headers:
  YourCustomHeader: "{{ 'my_static_value' | b64encode }}"
This keeps everything within the declarative config — no separate pre-encoding step needed. 👍 0 button 👎 0 button â„šī¸ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.