-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Labels
Description
Topic
OAUTH authentication
Relevant information
Hi!
I've found what seems a bug in the OAUTH authentication flow.
According to the RFC (https://datatracker.ietf.org/doc/html/rfc6749#section-5.1), the property "expires_in" in an OAUTH response is RECOMMENDED, but not MANDATORY. Airbyte is failing when the it does not come in the response
This is the error log I'm getting:
Traceback (most recent call last):
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py", line 152, in read
yield from self._read_stream(
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py", line 276, in _read_stream
for record_data_or_message in record_iterator:
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/streams/core.py", line 196, in read
for record_data_or_message in records:
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py", line 152, in read_records
yield from self.retriever.read_records(self.get_json_schema(), stream_slice) # type: ignore # records are of the correct type
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 436, in read_records
for stream_data in self._read_pages(record_generator, self.state, _slice):
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 355, in _read_pages
response = self._fetch_next_page(stream_state, stream_slice, next_page_token)
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/retrievers/simple_retriever.py", line 564, in _fetch_next_page
return self.requester.send_request(
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 347, in send_request
headers=self._request_headers(
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 225, in _request_headers
headers = self._get_request_options(
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 209, in _get_request_options
auth_options_method(),
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 57, in get_auth_header
token = self.access_token if self._is_access_token_flow else self.get_access_token()
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 67, in get_access_token
token, expires_in = self.refresh_access_token()
File "/home/airbyte/.pyenv/versions/3.10.15/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 169, in refresh_access_token
return response_json[self.get_access_token_name()], response_json[
KeyError: 'expires_in'