Seth Terrell
11/05/2025, 6:23 PM2025-11-05 10:11:00 error Encountered an error while checking availability of stream accounts. Error: 400 Client Error: Bad Request for url: https://login.microsoftonline.com/****/oauth2/v2.0/tokenError traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/checks/check_stream.py", line 91, in _check_stream_availability
stream_is_available, reason = availability_strategy.check_availability(stream, logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/availability_strategy.py", line 37, in check_availability
stream_slice = self.get_first_stream_slice(stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/availability_strategy.py", line 54, in get_first_stream_slice
return next(slices)
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py", line 148, in stream_slices
product = itertools.product(*sub_slices)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py", line 181, in stream_slices
for parent_record in parent_stream.read_only_records():
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/core.py", line 272, in read_only_records
yield from self.read(
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/core.py", line 196, in read
for record_data_or_message in records:
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py", line 161, in read_records
yield from self.retriever.read_records(self.get_json_schema(), stream_slice) # type: ignore # records are of the correct type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 526, in read_records
for stream_data in self._read_pages(record_generator, self.state, _slice):
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 396, in _read_pages
response = self._fetch_next_page(stream_state, stream_slice, next_page_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 327, in _fetch_next_page
return self.requester.send_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 461, in send_request
headers=self._request_headers(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 309, in _request_headers
headers = self._get_request_options(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 292, in _get_request_options
auth_options_method(),
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 85, in get_auth_header
token = self.access_token if self._is_access_token_flow else self.get_access_token()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 91, in get_access_token
token, expires_in = self.refresh_access_token()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 139, in refresh_access_token
response_json = self._make_handled_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/backoff/_sync.py", line 105, in retry
ret = target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 224, in _make_handled_request
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1024, 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/****/oauth2/v2.0/token
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/checks/check_stream.py", line 91, in _check_stream_availability
stream_is_available, reason = availability_strategy.check_availability(stream, logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/availability_strategy.py", line 37, in check_availability
stream_slice = self.get_first_stream_slice(stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/availability_strategy.py", line 54, in get_first_stream_slice
return next(slices)
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py", line 148, in stream_slices
product = itertools.product(*sub_slices)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/partition_routers/substream_partition_router.py", line 181, in stream_slices
for parent_record in parent_stream.read_only_records():
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/core.py", line 272, in read_only_records
yield from self.read(
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/core.py", line 196, in read
for record_data_or_message in records:
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py", line 161, in read_records
yield from self.retriever.read_records(self.get_json_schema(), stream_slice) # type: ignore # records are of the correct type
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 526, in read_records
for stream_data in self._read_pages(record_generator, self.state, _slice):
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 396, in _read_pages
response = self._fetch_next_page(stream_state, stream_slice, next_page_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 327, in _fetch_next_page
return self.requester.send_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 461, in send_request
headers=self._request_headers(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 309, in _request_headers
headers = self._get_request_options(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 292, in _get_request_options
auth_options_method(),
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 85, in get_auth_header
token = self.access_token if self._is_access_token_flow else self.get_access_token()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 91, in get_access_token
token, expires_in = self.refresh_access_token()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 139, in refresh_access_token
response_json = self._make_handled_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/backoff/_sync.py", line 105, in retry
ret = target(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 224, in _make_handled_request
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1024, 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/****/oauth2/v2.0/tokenkapa.ai
11/05/2025, 6:24 PMhttps://login.microsoftonline.com/common/oauth2/nativeclient. - Make sure the required API permissions are granted (see the [forum discussion](https://discuss.airbyte.io/t/1523)). If these settings are incorrect, you may see errors like invalid_client or 400 Bad Request during token refresh. 3. Check for Recent Changes If the connector was working and suddenly stopped, check if: - Any credentials (client secret, refresh token) have expired or been revoked. - There were changes in your Azure app registration or permissions. - The Airbyte connector or platform was recently upgraded, which could affect compatibility. 4. Error Details The error traceback shows the failure occurs during the OAuth token refresh process. This is consistent with either expired/invalid credentials or misconfigured Azure app settings. 5. Further Troubleshooting - Try re-authenticating and generating a new refresh token. - Double-check all configuration fields in Airbyte for typos or outdated values. - If you see a more specific error message (e.g., invalid_client), refer to the [forum post](https://discuss.airbyte.io/t/1523) for detailed troubleshooting steps. If after checking all the above the issue persists, you may want to review the full error response from Microsoft (sometimes included in the Airbyte logs) for more specific guidance. Summary: This error is almost always due to expired or invalid OAuth credentials, or a misconfiguration in your Azure app registration. Refresh your tokens and verify your Azure app settings as described above to resolve the issue. References: - [Bing Ads Source Setup Guide](https://docs.airbyte.com/integrations/sources/bing-ads#setup-guide) - [Forum: Airbyte Open Source and BingAds](https://discuss.airbyte.io/t/1523)kapa.ai
11/05/2025, 6:24 PM400 Client Error: Bad Request when trying to refresh the OAuth token at https://login.microsoftonline.com/****/oauth2/v2.0/token. This is a common OAuth authentication issue with the Bing Ads connector. ## Likely Causes The knowledge sources indicate several potential issues with Bing Ads OAuth authentication: 1. Missing or Invalid Refresh Token: According to [this GitHub issue](https://github.com/airbytehq/airbyte/issues/52691), there can be problems with missing refresh tokens in the OAuth flow. The error Missing 'refresh_token' in query params has been reported for Bing Ads and similar Microsoft OAuth connectors. 2. Client Secret Configuration: As documented in [another GitHub issue](https://github.com/airbytehq/airbyte/issues/53651), if you're setting up with Client ID and Developer Token without a client secret, you may get an error about an undefined client_secret parameter. However, adding a client secret can also lead to the missing refresh token error. 3. Expired Refresh Token: The [Bing Ads documentation](https://docs.airbyte.com/integrations/sources/bing-ads) states that "The refresh token expires in 90 days. Repeat the authorization process to get a new refresh token." ## Recommended Solutions 1. Verify Your Refresh Token: Even though you mentioned tokens are current, the refresh token may have expired (they expire after 90 days). You'll need to go through the OAuth authorization process again to obtain a new refresh token. Follow the steps in the [Bing Ads setup guide](https://docs.airbyte.com/integrations/sources/bing-ads): - [Register your application](https://docs.microsoft.com/en-us/advertising/guides/authentication-oauth-register?view=bingads-13) - [Request user consent](https://docs.microsoft.com/en-us/advertising/guides/authentication-oauth-consent?view=bingads-13l) - [Get a new refresh token](https://docs.microsoft.com/en-us/advertising/guides/authentication-oauth-get-tokens?view=bingads-13) 2. Check Application Type: According to [this forum discussion](https://discuss.airbyte.io/t/3067), ensure your Azure application is configured correctly: - Use "Mobile and desktop applications" (not "Web") - Set the redirect URI to: https://login.microsoftonline.com/common/oauth2/nativeclient - Enable "Allow public client flows" in your Azure app settings 3. Verify Tenant ID: If you're using a custom tenant ID instead of "common", ensure it's correctly configured in your Airbyte source settings. The error you're seeing is specifically during the token refresh process, which suggests the refresh token itself may be invalid or expired, despite other credentials being correct.Seth Terrell
11/05/2025, 6:57 PMclient_secret and updating the redirect_uri to https://airbyte.literati.dev/auth_flow.
Please advise, @kapa.ai.kapa.ai
11/05/2025, 6:57 PMkapa.ai
11/05/2025, 6:57 PMhttps://login.microsoftonline.com/common/oauth2/nativeclient and the app should be registered as a "Mobile and desktop application" with "Allow public client flows" set to Yes. Using a custom redirect URI like https://airbyte.literati.dev/auth_flow may not be supported unless your Azure app registration explicitly allows it and matches the Airbyte configuration requirements. Several users have reported issues when deviating from the documented redirect URI or app type, resulting in 400 errors or OAuth failures [see forum discussion](https://discuss.airbyte.io/t/1523). 2. Client Secret Usage If your app is registered as a public client (e.g., "Mobile and desktop"), you should not include the client_secret in your token requests. Including a client secret for a public client will result in errors like AADSTS90023: Public clients can't send a client secret [see forum discussion](https://discuss.airbyte.io/t/3067). If your app is registered as a confidential client (e.g., "Web"), then the client secret is required, but the redirect URI and flow must match accordingly. 3. Manual Token Generation Users have reported that generating tokens manually using scripts or tools that do not exactly match the Azure app registration and Airbyte's expected flow can lead to persistent 400 errors, even if the tokens appear to be valid when tested outside Airbyte [see GitHub issue](https://github.com/airbytehq/airbyte/issues/53651). The Airbyte connector expects the tokens and flow to be consistent with its configuration. 4. Airbyte Version and UI Behavior There have been recent changes in how Airbyte handles OAuth for Bing Ads. In some versions, the UI does not allow manual entry of refresh tokens, and Airbyte expects to handle the OAuth flow itself. Workarounds and fixes have been discussed, such as entering dummy values to trigger the UI, but these are version-dependent and may not be reliable [see GitHub issue](https://github.com/airbytehq/airbyte/issues/53651). Recommendations: - Double-check your Azure app registration: - If using Airbyte OSS, register as a "Mobile and desktop application" and set "Allow public client flows" to Yes. - Use the redirect URI https://login.microsoftonline.com/common/oauth2/nativeclient unless Airbyte documentation or your deployment specifically supports a custom URI. - Do not include client_secret if your app is a public client. - Follow the Airbyte documentation for Bing Ads setup exactly: - [Bing Ads Source Setup Guide](https://docs.airbyte.com/integrations/sources/bing-ads) - Ensure all parameters (client ID, developer token, refresh token, tenant ID) are correct and match your Azure app registration. - If you must use a custom redirect URI: - Ensure your Azure app registration allows it and that Airbyte is configured to expect it. There is no explicit documentation in the knowledge sources confirming support for custom redirect URIs in Airbyte for Bing Ads. - If you continue to get 400 errors: - Try re-registering the app and following the documented flow exactly, including the recommended redirect URI and app type. - If you are on an older version of Airbyte, consider upgrading, as some OAuth handling bugs have been fixed in recent releases [see GitHub issue](https://github.com/airbytehq/airbyte/issues/53651). Summary: The most likely cause of your persistent 400 error is a mismatch between your Azure app registration (app type, redirect URI, client secret usage) and what Airbyte expects. The knowledge sources do not provide evidence that using a custom redirect URI like https://airbyte.literati.dev/auth_flow is supported. For best results, follow the documented flow and settings exactly. If you have already done so and the issue persists, there may be a version-specific bug or a deeper configuration issue. If you need more specific troubleshooting, please provide the exact error message returned in the response body from Microsoft, as this can help pinpoint the root cause.