I'm developing a source connector for Fortnox, and...
# help-connector-development
h
I'm developing a source connector for Fortnox, and are using an OAuth Authentication Code Grant type for authentication. I need to supply ClientId ClientSecret and RefreshToken to configure this connector. My problem is the following: Whenever the refresh token is used to get a new access token a new refresh token is issued and the old one is invalidated, (see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.14.2 under Refresh Token Rotation) The question I have is, if there is any possibility of storing state in the source connector, or somehow update the config to always store the most current refreshtoken in use. I'm thinking that storing the current refresh token on the connection between source and destination is not a good solution in case the same configured source is used in two different connections. Also I have some concerns around the locking and updating this variable to make sure that the refresh-token-chain never get two concurrent updates which could potentially invalidate the refresh token chain.
j
Kul, hade ett liknande problem mot cinode. What I did was letting airbyte always start a new chain of tokens by extending the oauth authentication, as the client secret allows for being reused for my source. Remember that airbyte has an API where you could inject new authentication credentials to refresh the state allowing you create an external state holder if you want. https://airbyte-public-api-docs.s3.us-east-2.amazonaws.com/rapidoc-api-docs.html
h
Nice thanks, I'll have to look into this!
I will answer myself now on this one in case somebody stumbles across this. There is an authenticator for this already that I found (it uses the non-deprecated authenticators as a base class).
Copy code
SingleUseRefreshTokenOauth2Authenticator
I noticed that updating the source connector configuration like this could be prone to race conditions, especially if the token is refreshed during the CHECK and then there is a possibility that the old token information is passed to the READ. At least that is what the logs indicated.