<@U04S8PLJWMT> i created my custom python connecto...
# ask-ai
o
@kapa.ai i created my custom python connector for gitlab gitlab oauth are using a single time use refresh token this is the response example:
Copy code
{
  "access_token": "c97d1fe52119f38c7f67f0a14db68d60caa35ddc86fd12401718b649dcfa9c68",
  "token_type": "bearer",
  "expires_in": 7200,
  "refresh_token": "803c1fd487fec35562c205dac93e9d8e08f9d3652a24079d704df3039df1158f",
  "created_at": 1628711391
}
it means that if i want to oauth again i need to use the new refresh token from the response. i used the
Oauth2Authenticator
class but it doesn't work with that and I also used the
SingleUseRefreshTokenOauth2Authenticator
which does works. my issue is that after the auth method being done the new refresh_token isn't being saved which means the next run or check the oauth method will not work because it is keeps using the initial refresh token which isn't valid anymore how can i save the new refresh token in the config param inorder to use it in the next connector run
k
To handle single-use refresh tokens in Airbyte connectors—such as with GitLab, where each refresh token can only be used once and a new one is returned with each token refresh—you need to ensure that the connector updates its configuration with the new refresh token after each successful refresh. This way, the next sync will use the latest valid refresh token. Declarative Connectors / Connector Builder UI: - Use the "Refresh Token Updater" (sometimes called "Overwrite config with refresh token response") option in the connector configuration. - When enabled, Airbyte will extract the new refresh token from the token refresh endpoint response (by default from the
refresh_token
property, but this can be customized). - The connector will then automatically update its configuration with the new refresh token for the next run. This is specifically designed for APIs like GitLab and Smartsheet, which use single-use refresh tokens. You must also provide an initial access token and its expiry date for testing and initial setup. References: - [Single-Use Refresh Tokens](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#single-use-refresh-tokens) - [Update refresh token from authentication response](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/authentication#update-refresh-token-from-authentication-response) Python CDK Connectors: If you are using the Python CDK and the
SingleUseRefreshTokenOauth2Authenticator
, Airbyte is working on platform support to persist the new refresh token in the config automatically. As of now, this feature depends on the platform handling "control messages" emitted by the connector to update the configuration. If your platform version does not yet support this, the refresh token will not be persisted between runs, and you will encounter the issue you described. Current Status: - The feature to persist the new refresh token is being rolled out in Airbyte ([see forum discussion](https://discuss.airbyte.io/t/3275)). - If your Airbyte instance does not yet support this, you may need to wait for the platform update or use a workaround (such as manually updating the config or using state messages, though this is not the recommended long-term solution). Summary: Enable the "Refresh Token Updater" in declarative connectors or Connector Builder UI. For Python CDK, ensure your Airbyte platform version supports config mutation via control messages for single-use refresh tokens. If not, monitor Airbyte updates for this feature. If you need more specific implementation guidance for your connector type, please specify whether you are using the declarative YAML approach or the Python CDK.
o
@kapa.ai how can i check if my airbyte version supports config mutation and how can i check if it enabled
k
A message from kapa.ai
I'm sorry, but the knowledge sources do not provide explicit instructions on how to check if your Airbyte version supports config mutation (i.e., updating the connector config during a sync via control messages) or how to verify if this feature is enabled. The documentation does describe the AirbyteControlMessage and its use for updating connector configuration during a sync, which is essential for handling single-use refresh tokens. However, it does not specify how to check for platform support or enablement of this feature in your Airbyte instance. It only states that the orchestrator is expected to handle these messages and update the persisted configuration accordingly, but does not provide version numbers or feature flags to check for support [Airbyte Protocol: AirbyteControlMessage](https://docs.airbyte.com/platform/next/understanding-airbyte/airbyte-protocol#airbytecontrolmessage). If you need to confirm support, you may need to consult Airbyte's official release notes or reach out to the Airbyte community for guidance on the specific version where this feature became available.