I'm using the OAuth legacy authentication method t...
# ask-ai
d
I'm using the OAuth legacy authentication method to connect to an API. When I connect with my test stream, it works fine. However, when I connect with a second stream, I get a 401 unauthorized error. I've confirmed with vendor support that the issue is not a scope problem but rather each request is generating a new access_token. It appears that the original access_token does not expire and generating this new access_token is why my request is failing with my second stream (according to the vendor's support). How can I set up the OAuth legacy connector to use the initial access token and not regenerate a new access_token with each request?
k
Based on the information in the knowledge sources, the OAuth legacy (Partial OAuth) authentication method in Airbyte is designed to use a refresh token to obtain a new access token when the current one expires. By default, if you provide a refresh token, Airbyte will attempt to refresh the access token as needed, typically when it detects that the token has expired or is about to expire. However, in your case, the vendor's API issues a non-expiring access token, and generating a new access token for each request causes issues. You want Airbyte to use the initial access token for all requests and not attempt to refresh it or generate a new one. How to achieve this: - In the Partial OAuth (legacy) setup, you can provide only the
access_token
in your connector configuration and omit the
refresh_token
and
token_refresh_endpoint
. This way, Airbyte will use the provided access token for all requests and will not attempt to refresh it, since it has no means to do so. - If your connector configuration currently includes a
refresh_token
and
token_refresh_endpoint
, remove these fields and only provide the
access_token
. This should prevent Airbyte from trying to generate a new access token for each request. Relevant documentation: > The partial OAuth flow is a simpler flow that allows you to use an existing access (or refresh) token to authenticate with the API. The catch is that the user needs to implement the start of the OAuth flow manually to obtain the
access_token
and the
refresh_token
and pass them to the connector as a part of the
config
object. > ... > If the access token expires, the connection will automatically request a new one. > ... > Keep in mind that the OAuth authentication method does not implement a single-click authentication experience for the end user configuring the connector - it will still be necessary to obtain client id, client secret and refresh token from the API and manually enter them into the configuration form. > > [Partial OAuth (legacy)](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#partial-oauth-legacy) Summary of steps: 1. Remove
refresh_token
and
token_refresh_endpoint
from your connector configuration. 2. Provide only the
access_token
(and any other required static credentials). 3. Airbyte will use the provided access token for all requests and will not attempt to refresh it. If you need to use a refresh token in the future (for expiring tokens), you can re-add those fields. But for your current use case with a non-expiring access token, this approach should resolve the issue. If you need more specific configuration examples, please provide your current YAML or JSON config, and I can help tailor it.