Skip to content

Commit cf93e3a

Browse files
author
Baz
authored
fix: (DeclarativeOAuthFlow) - fix the bug when refresh_token is not provided from the test authentication (#186)
1 parent ae1211f commit cf93e3a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,13 @@ def __call__(self, request: requests.PreparedRequest) -> requests.PreparedReques
5454

5555
def get_auth_header(self) -> Mapping[str, Any]:
5656
"""HTTP header to set on the requests"""
57-
token = (
58-
self.access_token
59-
if (
60-
not self.get_token_refresh_endpoint()
61-
or not self.get_refresh_token()
62-
and self.access_token
63-
)
64-
else self.get_access_token()
65-
)
57+
token = self.access_token if self._is_access_token_flow else self.get_access_token()
6658
return {"Authorization": f"Bearer {token}"}
6759

60+
@property
61+
def _is_access_token_flow(self) -> bool:
62+
return self.get_token_refresh_endpoint() is None and self.access_token is not None
63+
6864
def get_access_token(self) -> str:
6965
"""Returns the access token"""
7066
if self.token_has_expired():

0 commit comments

Comments
 (0)