Ofek Eliahu
08/24/2025, 1:12 PMbasic_auth = BasicHttpAuthenticator(
username=credentials["client_id"],
password=credentials["client_secret"],
config={},
parameters={},
)
return SingleUseRefreshTokenOauth2Authenticator(
connector_config=config,
token_refresh_endpoint="https://app.gong.io/oauth2/generate-customer-token",
client_id=credentials["client_id"],
client_secret=credentials["client_secret"],
access_token_config_path=("access_token",),
refresh_token_config_path=("refresh_token",),
token_expiry_date_config_path=("token_expiry_date",),
refresh_request_body={
"access_type": "offline",
},
refresh_request_headers=basic_auth.get_auth_header(),
)kapa.ai
08/24/2025, 1:13 PMSingleUseRefreshTokenOauth2Authenticator, but the platform must support persisting the updated config after a sync. If the platform only updates the token in memory and does not persist it, the next run will use the old (now invalid) refresh token, causing failures. Relevant Documentation: - The Airbyte documentation and forum posts confirm that for single-use refresh tokens, the connector must update its configuration with the new refresh token, and this requires platform support to persist the updated config. If the platform does not persist the new token, you will see exactly the behavior you describe: it works for the first run, but fails on subsequent runs because the new refresh token is not saved for future use [[Single-Use Refresh Tokens](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#single-use-refresh-tokens)]. - There is an ongoing development in Airbyte to support this feature fully, as discussed in the forum: the platform needs to handle "control messages" from the connector to update the actor configuration during syncs. Until this is fully supported, the refresh token will not be persisted automatically [[Forum Post: Handle expiring refresh tokens with oauth](https://discuss.airbyte.io/t/3275)]. What You Can Do: - Double-check that your Airbyte platform version supports persisting config updates from the connector. If not, this is a platform limitation, not a problem with your connector code. - If you are using a recent version and it still does not persist, you may need to wait for the platform feature to be fully released and enabled. - As a workaround, some users have considered using Airbyte state or other mechanisms, but this is not the recommended or supported approach. Summary: Your configuration is correct for the connector side, but the persistence of the new refresh token depends on Airbyte platform support. If the platform does not persist the updated config, the connector will not work as expected with single-use refresh tokens. This is a known limitation and is being addressed by the Airbyte team [[Single-Use Refresh Tokens](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#single-use-refresh-tokens)], [[Forum Post: Handle expiring refresh tokens with oauth](https://discuss.airbyte.io/t/3275)].Ofek Eliahu
08/24/2025, 1:34 PMkapa.ai
08/24/2025, 1:34 PMkapa.ai
08/24/2025, 1:34 PMclient_id:client_secret and set this value in the Authorization header as Basic <base64-encoded-string>. This is a common OAuth pattern and is supported in Airbyte's declarative OAuth configuration. Declarative Example: You can configure this in your connector's manifest by specifying the access_token_headers with the Authorization header set to the base64-encoded value. Here’s how you can do it: yaml access_token_headers: Authorization: "{{ (client_id_value ~ ':' ~ client_secret_value) | b64encode | prepend('Basic ') }}" This will send the header: Authorization: Basic <base64(client_id:client_secret)> Reference from Airbyte Documentation: > Example with the header value encoded into base64-string > > > access_token_headers: > Authorization: "{{ (client_id_value ~ ':' ~ client_secret_value) | b64encode | prepend('Basic ') }}" > > [Advanced Case: client secret is a request header not a query parameter](https://docs.airbyte.com/platform/next/connector-development/config-based/advanced-topics/oauth#advanced-case-client-secret-is-a-request-header-not-a-query-parameter) Python CDK Approach: If you are using the Python CDK, you can use the BasicHttpAuthenticator to generate the header and pass it to your OAuth authenticator’s refresh_request_headers parameter, as you are already doing: python basic_auth = BasicHttpAuthenticator( username=credentials["client_id"], password=credentials["client_secret"], config={}, parameters={}, ) refresh_request_headers = basic_auth.get_auth_header() Then, pass refresh_request_headers to your OAuth authenticator. This will ensure the client ID and secret are sent as Basic Auth in the OAuth request [[CDK Python HTTP Streams Authentication](https://docs.airbyte.com/platform/connector-development/cdk-python/http-streams#authentication)]. Summary: - Encode client_id:client_secret as base64 and set it in the Authorization header as Basic <base64-string>. - In declarative YAML, use the access_token_headers field as shown above. - In Python CDK, use BasicHttpAuthenticator and pass the header to your OAuth authenticator. Let me know if you need a full code example!