Is there something wrong with Oauth in Airbyte? I ...
# replication-ask-ai
l
Is there something wrong with Oauth in Airbyte? I am trying to create a low cdk connector for Zoho Books. When I use OAUTH as the authentication method, I get server error. But when I choose bearer as the authentication method, I get the data.
k
A message from kapa.ai
It seems that you're facing issues with OAuth authentication in Airbyte while creating a low-code CDK connector for Zoho Books. Based on the information extracts, OAuth authentication in the connector builder does not implement a single-click authentication experience for the end user configuring the connector. You will still need to obtain the client ID, client secret, and refresh token from the API and manually enter them into the configuration form [source](https://docs.airbyte.com/connector-development/connector-builder-ui/authentication). If the API uses a short-lived refresh token that expires after a short amount of time and needs to be refreshed as well, or if other grant types like PKCE are required, it's not possible to use the connector builder with OAuth authentication. In such cases, you may need to use the [low-code CDK](https://docs.airbyte.com/connector-development/config-based/low-code-cdk-overview) or [Python CDK](https://docs.airbyte.com/connector-development/cdk-python/) [source](https://docs.airbyte.com/connector-development/connector-builder-ui/authentication). For custom authentication methods, you can refer to the [custom components documentation](https://docs.airbyte.com/connector-development/config-based/advanced-topics#custom-components). If you still face issues, it would be helpful to review the error messages and logs to identify the specific problem with OAuth authentication in your case.
l
Here are the logs
Copy code
access_token - Traceback (most recent call last):
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/connector_builder/message_grouper.py", line 182, in _read_stream
    yield from AirbyteEntrypoint(source).read(source.spec(self.logger), config, configured_catalog, {})
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/entrypoint.py", line 141, in read
    yield from self.source.read(self.logger, config, catalog, state)
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py", line 136, in read
    yield from super().read(logger, config, catalog, state)
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 141, in read
    raise e
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 121, in read
    yield from self._read_stream(
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 196, in _read_stream
    for record in record_iterator:
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 333, in _read_full_refresh
    for record_data_or_message in record_data_or_messages:
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py", line 100, in read_records
    for record in self.retriever.read_records(sync_mode, cursor_field, stream_slice, stream_state):
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 398, in read_records
    for record in records_generator:
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/http.py", line 439, in _read_pages
    request, response = self._fetch_next_page(stream_slice, stream_state, next_page_token)
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/http.py", line 453, in _fetch_next_page
    request = self._create_prepared_request(
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/http.py", line 280, in _create_prepared_request
    return self._session.prepare_request(requests.Request(**args))
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/requests/sessions.py", line 486, in prepare_request
    p.prepare(
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/requests/models.py", line 372, in prepare
    self.prepare_auth(auth, url)
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/requests/models.py", line 603, in prepare_auth
    r = auth(self)
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 28, in __call__
    request.headers.update(self.get_auth_header())
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 33, in get_auth_header
    return {"Authorization": f"Bearer {self.get_access_token()}"}
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 38, in get_access_token
    token, expires_in = self.refresh_access_token()
  File "/root/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/auth/oauth.py", line 116, in refresh_access_token
    return response_json[self.get_access_token_name()], response_json[self.get_expires_in_name()]
KeyError: 'access_token'