Error creating connection with Google Drive connector using OAuth2 credentials

Summary

The user is facing an issue when trying to create a connection with the Google Drive connector using OAuth2 credentials. The error message indicates an ‘unauthorized_client’ error, suggesting a problem with the provided credentials.


Question

Hello Airbyte community! I am using the google-drive connector on cloud airbyte. I am passing oauth2 credentials from my app. I am able to create source via API, but when I try to create a connection (via API) I am getting an error. Also when I re-run test on my source, it seems to be using Airbyte’s google oauth credentials (instead of mine). Any suggestion?

Here’s the error message.

['Traceback (most recent call last):\n File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py", line 81, in _check_list_files\n file = next(iter(stream.get_files()))\n File "/airbyte/integration_code/source_google_drive/stream_reader.py", line 108, in get_matching_files\n results = request.execute()\n File "/usr/local/lib/python3.9/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper\n return wrapped(*args, **kwargs)\n File "/usr/local/lib/python3.9/site-packages/googleapiclient/http.py", line 923, in execute\n resp, content = _retry_request(\n File "/usr/local/lib/python3.9/site-packages/googleapiclient/http.py", line 191, in _retry_request\n resp, content = http.request(uri, method, *args, **kwargs)\n File "/usr/local/lib/python3.9/site-packages/google_auth_httplib2.py", line 209, in request\n self.credentials.before_request(self._request, method, uri, request_headers)\n File "/usr/local/lib/python3.9/site-packages/google/auth/credentials.py", line 230, in before_request\n self._blocking_refresh(request)\n File "/usr/local/lib/python3.9/site-packages/google/auth/credentials.py", line 193, in _blocking_refresh\n self.refresh(request)\n File "/usr/local/lib/python3.9/site-packages/google/oauth2/credentials.py", line 431, in refresh\n ) = reauth.refresh_grant(\n File "/usr/local/lib/python3.9/site-packages/google/oauth2/reauth.py", line 365, in refresh_grant\n _client._handle_error_response(response_data, retryable_error)\n File "/usr/local/lib/python3.9/site-packages/google/oauth2/_client.py", line 72, in _handle_error_response\n raise exceptions.RefreshError(\ngoogle.auth.exceptions.RefreshError: (\'unauthorized_client: Unauthorized\', {\'error\': \'unauthorized_client\', \'error_description\': \'Unauthorized\'})\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py", line 62, in check_availability_and_parsability\n file = self._check_list_files(stream)\n File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py", line 87, in _check_list_files\n raise CheckAvailabilityError(FileBasedSourceError.ERROR_LISTING_FILES, stream=stream.name) from exc\nairbyte_cdk.sources.file_based.exceptions.CheckAvailabilityError: Error listing files. Please check the credentials provided in the config and verify that they provide permission to list files. Contact Support if you need assistance.\nstream=klrc1etngxga\n']```

<br>

---

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C021JANJ6TY/p1731013991915369) if you want 
to access the original thread.

[Join the conversation on Slack](https://slack.airbyte.com)

<sub>
["google-drive-connector", "oauth2-credentials", "api", "error", "unauthorized-client"]
</sub>