Error connecting to OData V4 from Microsoft Business Central 365 using Airbyte connector builder

Summary

The user is facing an ‘invalid_request’ error when trying to connect to OData V4 from Microsoft Business Central 365 using Airbyte connector builder. The error message indicates that the ‘scope’ field is missing from the credential. The user has shared their YAML configuration for reference.


Question

Good afternoon everyone, I would like to introduce myself. My name is Mikel and we are starting with Airbyte. I was trying to connect to OData V4 from Microsoft Business Central 365 of our company to see if I was able to retrieve some data. I have started to create a connector using “Builder”. I enter everything as I have it in Insomnia (where it works correctly for me, also in a Python script using the MSAL library).
I try to connect via OAuth, just like in Insomnia and Python, but I get the error: {
“status”: 400,
“body”: {
“error”: “invalid_request”,
“error_description”: “AADSTS90014: The required field ‘scope’ is missing from the credential. Ensure that you have all the necessary parameters for the login request.”,
“error_codes”: [
90014
],
“timestamp”: “2024-05-15 15:15:18Z”,
“trace_id”: “2b0626bc-b1cd-44c7-9de1-bd469fe77900”,
“correlation_id”: “5967d820-ad17-4b2d-b4a7-d6e2dff8fd75”,
“error_uri”: “https://login.microsoftonline.com/error?code=90014

This is my YAML current configuration, where it only lets me pass the scope as an optional parameter:

version: 0.85.0

type: DeclarativeSource

check:
type: CheckStream
stream_names:
- COMPANIES

definitions:
streams:
COMPANIES:
type: DeclarativeStream
name: COMPANIES
retriever:
type: SimpleRetriever
requester:
$ref: ‘#/definitions/base_requester’
path: Company
http_method: GET
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
schema_loader:
type: InlineSchemaLoader
schema:
$ref: ‘#/schemas/COMPANIES’
base_requester:
type: HttpRequester
url_base: >-
https://api.businesscentral.dynamics.com/(TENANT_ID_HIDED_FOR_SECURITY_REASONS)/Production/ODataV4/
authenticator:
type: OAuthAuthenticator
scopes:
- https://api.businesscentral.dynamics.com/.default
client_id: ‘{{ config[“client_id”] }}’
grant_type: client_credentials
client_secret: ‘{{ config[“client_secret”] }}’
refresh_request_body: {}
token_refresh_endpoint: >-
https://login.microsoftonline.com/(TENANT_ID_HIDED_FOR_SECURITY_REASONS)/oauth2/v2.0/token

streams:

  • $ref: ‘#/definitions/streams/COMPANIES’

spec:
type: Spec
connection_specification:
type: object
$schema: http://json-schema.org/draft-07/schema#
required:
- client_id
- client_secret
properties:
client_id:
type: string
order: 0
title: Client ID
airbyte_secret: true
client_secret:
type: string
order: 1
title: Client secret
airbyte_secret: true
additionalProperties: true

metadata:
autoImportSchema:
COMPANIES: true

schemas:
COMPANIES:
type: object
$schema: http://json-schema.org/draft-07/schema#
additionalProperties: true
properties: {}

Would someone be so kind as to help me with this issue? Thank you very much for your precious help. Best regards.



This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want to access the original thread.

Join the conversation on Slack

["odata-v4", "microsoft-business-central-365", "airbyte-connector-builder", "oauth-error", "yaml-configuration"]

Here is connector log error:

ERROR
Something went wrong in the connector. See the logs for more details. - Traceback (most recent call last):
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py”, line 136, in read
yield from self._read_stream(
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py”, line 237, in _read_stream
for record_data_or_message in record_iterator:
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/core.py”, line 145, in read
for record_data_or_message in records:
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py”, line 120, in read_records
yield from self.retriever.read_records(self.get_json_schema(), stream_slice)
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py”, line 324, in read_records
for stream_data in self._read_pages(record_generator, self.state, _slice):
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py”, line 288, in _read_pages
response = self._fetch_next_page(stream_state, stream_slice, next_page_token)
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py”, line 428, in _fetch_next_page
return self.requester.send_request(
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py”, line 454, in send_request
headers=self._request_headers(stream_state, stream_slice, next_page_token, request_headers),
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py”, line 308, in _request_headers
headers = self._get_request_options(
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py”, line 292, in _get_request_options
auth_options_method(),
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py”, line 56, in get_auth_header
return {“Authorization”: f"Bearer {self.get_access_token()}"}
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py”, line 61, in get_access_token
token, expires_in = self.refresh_access_token()
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py”, line 150, in refresh_access_token
response_json = self._get_refresh_access_token_response()
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/backoff/_sync.py”, line 105, in retry
ret = target(*args, **kwargs)
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py”, line 132, in _get_refresh_access_token_response
response.raise_for_status()
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/requests/models.py”, line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/token
ERROR
None - Traceback (most recent call last):
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/connector_builder/message_grouper.py”, line 290, in _read_stream
yield from AirbyteEntrypoint(source).read(source.spec(self.logger), config, configured_catalog, state)
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/entrypoint.py”, line 166, in read
for message in self.source.read(self.logger, config, catalog, state):
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py”, line 167, in read
yield from super().read(logger, config, catalog, state)
File “/home/airbyte/.pyenv/versions/3.9.11/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py”, line 185, in read
raise AirbyteTracedException(message=error_message, failure_type=FailureType.config_error)
airbyte_cdk.utils.traced_exception.AirbyteTracedException: None