Ofek Eliahu
08/12/2025, 2:46 PM{
"access_token": "c97d1fe52119f38c7f67f0a14db68d60caa35ddc86fd12401718b649dcfa9c68",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "803c1fd487fec35562c205dac93e9d8e08f9d3652a24079d704df3039df1158f",
"created_at": 1628711391
}
To re-authenticate, I need to use the new refresh token from the response. I’m using the SingleUseRefreshTokenOauth2Authenticator to handle this, which saves the new refresh_token, access_token, and expire_time in memory for the next authentication.
The issue is that while these config values are correctly saved and used in memory, they are not being persisted in storage for future runs. When I create a new source, a validation check is performed, which passes and creates the source. However, after this check, the OAuth refresh token becomes invalid, and the new one isn’t saved to storage. As a result, I can’t create a new connection based on this source since the refresh token isn’t being updated in storage.
Is anyone faced this issue before and knows how to solve it?Ofek Eliahu
08/12/2025, 3:10 PMreturn SingleUseRefreshTokenOauth2Authenticator(
connector_config=config,
token_refresh_endpoint=_TOKEN_REFRESH_ENDPOINT,
client_id=gitlab_credentials["client_id"],
client_secret=gitlab_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",
},
)
After:
return SingleUseRefreshTokenOauth2Authenticator(
connector_config=config,
token_refresh_endpoint=_TOKEN_REFRESH_ENDPOINT,
client_id=gitlab_credentials["client_id"],
client_secret=gitlab_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",
},
)
The issue was that I was passing the paths as strings rather than tuples. In Python, when you place a value inside brackets (e.g., ("access_token")), it treats it as just that value, not as a tuple. This always bugs me when working with tuples that have only one value, because to make it a tuple, you need to add a comma:
("access_token") -> ("access_token",)Aidan Lister
08/17/2025, 9:01 PMOfek Eliahu
08/18/2025, 1:40 PMOfek Eliahu
08/24/2025, 9:24 PM