Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OAUTH Authentication] "expires_in" property in an OAUTH response is expected as mandatory #54198

Open
isaac-perez-nexthink opened this issue Feb 21, 2025 · 2 comments

Comments

@isaac-perez-nexthink
Copy link

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

Image

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'
@marcosmarxm
Copy link
Member

cc @airbytehq/dev-extensibility

@bazarnov
Copy link
Collaborator

@marcosmarxm I'll take a look.

@bazarnov bazarnov self-assigned this Feb 25, 2025
@bnchrch bnchrch added the fast-fix-monday A Marketplace team thing ✨ label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants