I'm having significant issue with refresh_token_up...
# replication-troubleshooting
a
I'm having significant issue with refresh_token_updater ... I just can't get it to work. Our API uses single-use refresh tokens with sliding window expiration. The problem is with refresh token reuse. Here's what's happening: - API Response: SKY returns new refresh_token in every token refresh (sliding window) - Expected: Airbyte should save the new refresh_token to client_refresh_token config field - Actual: Airbyte keeps using the old refresh_token, causing 400 "invalid_grant" errors - Evidence: Proxy logs show Airbyte using old token even after successful refresh that returned new token Each token refresh gives a new refresh token, and the old one becomes invalid. But Airbyte is not updating its stored refresh token with the new one from the response. The refresh_token_updater is not working as expected or is misconfigured. OAuthAuthenticator Section authenticator: type: OAuthAuthenticator client_id_name: client_id client_id: "{{ config['client_id'] }}" client_secret_name: client_secret client_secret: "{{ config['client_secret'] }}" refresh_token_name: refresh_token refresh_token: "{{ config['client_refresh_token'] }}" access_token_name: access_token access_token_value: "{{ config['client_access_token'] }}" expires_in_name: expires_in grant_type_name: grant_type grant_type: refresh_token token_refresh_endpoint: https://… refresh_request_body: {} refresh_request_headers: Authorization: >- Basic {{ (config['client_id'] + ':' + config['client_secret']) | base64encode }} Content-Type: application/x-www-form-urlencoded refresh_token_updater: refresh_token_name: refresh_token access_token_config_path: - client_access_token refresh_token_config_path: - client_refresh_token token_expiry_date_config_path: - oauth_token_expiry_date refresh_token_error_status_codes: [] refresh_token_error_values: [] Connection Specification Section spec: type: Spec connection_specification: type: object required: - client_id - client_secret - subscription_key properties: client_id: type: string title: Client ID airbyte_secret: true order: 0 client_secret: type: string title: Client Secret airbyte_secret: true order: 1 subscription_key: type: string title: Subscription Key airbyte_secret: true order: 2 client_refresh_token: type: string title: Refresh Token airbyte_secret: true airbyte_hidden: true order: 3 client_access_token: type: string title: Access Token airbyte_secret: true order: 4 airbyte_hidden: true oauth_token_expiry_date: type: string title: Token expiry date format: date-time airbyte_hidden: true order: 5
k
Based on your description and the provided configuration, you are correctly using the refresh_token_updater to handle single-use refresh tokens. This is the recommended approach for APIs that return a new refresh token with every access token refresh, as described in the Airbyte documentation. When configured properly, Airbyte should extract the new refresh token from the token refresh response and update the config field (e.g., client_refresh_token) for the next sync, preventing reuse of expired tokens and avoiding "invalid_grant" errors [Single-Use Refresh Tokens](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#single-use-refresh-tokens). Key points to check: 1. refresh_token_updater Configuration: Your YAML snippet appears correct. The refresh_token_updater should look like this:
Copy code
yaml    refresh_token_updater:      refresh_token_name: refresh_token      access_token_config_path:        - client_access_token      refresh_token_config_path:        - client_refresh_token      token_expiry_date_config_path:        - oauth_token_expiry_date      refresh_token_error_status_codes: []      refresh_token_error_values: []
This matches the documented approach for single-use refresh tokens [Advanced Case: refresh token / single-use refresh token support](https://docs.airbyte.com/platform/next/connector-development/config-based/advanced-topics/oauth#advanced-case-refresh-token--single-use-refresh-token-support). 2. Connector Spec: Your spec includes client_refresh_token as a hidden, required field, which is correct. 3. Common Pitfalls: - Overwrite Config Option: In the Connector Builder UI, ensure that the "Overwrite config with refresh token response" (or "Refresh Token Updater") option is enabled. This is required for Airbyte to update the config with the new refresh token [Update refresh token from authentication response](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/authentication#update-refresh-token-from-authentication-response). - Testing Values: When using this option, you must specify an initial access token and its expiry date in the "Testing values" menu [Single-Use Refresh Tokens](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#single-use-refresh-tokens). - Correct Property Names: Double-check that the property names in your refresh_token_updater (e.g., refresh_token_name, refresh_token_config_path) exactly match the names in your config and the token refresh response. 4. Known Issues: There have been reports of similar issues in the community and with other connectors (e.g., QuickBooks), where Airbyte did not update the refresh token as expected, leading to repeated use of expired tokens and sync failures. In those cases, the solution was to ensure the refresh_token_updater was configured and enabled properly, and that the connector was updated to a version supporting this feature [Github Issue: source-quickbooks token expires every 24h](https://github.com/airbytehq/airbyte/issues/49842). If it still doesn't work: - Make sure you are running a recent version of Airbyte that supports refresh_token_updater and config mutation. - Check Airbyte logs for errors or warnings related to config updates or token refresh. - If using Airbyte Cloud, ensure your workspace has the necessary permissions for config mutation. - If the problem persists, it may be a platform bug or a limitation in your Airbyte version. This feature relies on Airbyte's ability to persist config changes between syncs, which was only recently added and may not be available in all environments [Forum: Handle expiring refresh tokens with oauth](https://discuss.airbyte.io/t/3275). Summary: Your configuration appears correct according to the documentation. If Airbyte is not updating the refresh token, double-check the "Overwrite config with refresh token response" setting in the UI, ensure your property names match, and verify you are on a recent Airbyte version. If all else fails, this may be a platform issue, and you should consider raising a bug report with your logs and configuration. Let me know if you need help troubleshooting specific logs or error messages!