Summary
Forbidden error is encountered when trying to connect to the API from Python SDK, despite successful connections via UI. Various authentication methods have been attempted without success.
Question
Hey guys!
Getting forbidden error via API
• abctl simple launch for OSS
• UI is reachable with username pass
• all functionality in ui is good (successive connections syncs etc.)
• when I try to connect from python SDK with same username/pass getting Forbidden error
• also tried different ways for auth (token etc.) - same forbidden
• username/password looks ok since when I change them I’m getting unauthorized error.
here is full error
Cell In[92], line 1
----> 1 res = s.connections.get_connection(request=api.GetConnectionRequest(
2 connection_id='cdd4bf7e-ed72-406a-a882-6d9a1f6adcd1',
3 ))
5 if res.connection_response is not None:
6 # handle response
7 pass
File ~/PycharmProjects/ai-insights/src/venv/lib/python3.11/site-packages/airbyte_api/connections.py:173, in Connections.get_connection(self, request)
171 raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
172 elif http_res.status_code == 403 or http_res.status_code == 404 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
--> 173 raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
174 else:
175 raise errors.SDKError('unknown status code received', http_res.status_code, http_res.text, http_res)
SDKError: API error occurred: Status 403
{"message":"Forbidden","_embedded":{"errors":[{"message":"Forbidden","_embedded":{},"_links":{}}]},"_links":{"self":{"href":"/api/v1/connections/cdd4bf7e-ed72-406a-a882-6d9a1f6adcd1","templated":false}}}```
and here is code to reproduce
```import airbyte_api
from airbyte_api import models, api
s = airbyte_api.AirbyteAPI(
server_url='<http://localhost:8000/api/v1>',
security=models.Security(
basic_auth=models.SchemeBasicAuth(
password='pass',
username='name',
),
),
)
res = s.connections.get_connection(request=api.GetConnectionRequest(
connection_id='some_id',
))```
<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/p1722874470501729) if you want
to access the original thread.
[Join the conversation on Slack](https://slack.airbyte.com)
<sub>
["forbidden-error", "api", "python-sdk", "authentication", "ui-connection"]
</sub>