@@ -90,7 +90,8 @@ def get_access_token(self) -> str:
9090 if self .token_has_expired ():
9191 token , expires_in = self .refresh_access_token ()
9292 self .access_token = token
93- self .set_token_expiry_date (expires_in )
93+ if expires_in is not None :
94+ self .set_token_expiry_date (expires_in )
9495
9596 return self .access_token
9697
@@ -134,7 +135,7 @@ def refresh_access_token(self) -> Tuple[str, Union[str, int, None]]:
134135 """
135136 Returns the refreshed access token and its expiration datetime
136137
137- :return: a tuple of (access_token, token_lifespan )
138+ :return: a tuple of (access_token, token_expiry_date )
138139 """
139140 response_json = self ._make_handled_request ()
140141 self ._ensure_access_token_in_response (response_json )
@@ -284,7 +285,7 @@ def _parse_token_expiration_date(self, value: Union[str, int]) -> AirbyteDateTim
284285 f"Invalid expires_in value: { value } . Expected number of seconds when no format specified."
285286 )
286287
287- def _extract_access_token (self , response_data : Mapping [str , Any ]) -> Any :
288+ def _extract_access_token (self , response_data : Mapping [str , Any ]) -> str | None :
288289 """
289290 Extracts the access token from the given response data.
290291
@@ -297,18 +298,17 @@ def _extract_access_token(self, response_data: Mapping[str, Any]) -> Any:
297298 access_token = self ._find_and_get_value_from_response (response_data , self .get_access_token_name ())
298299 return str (access_token ) if access_token is not None else None
299300
300- def _extract_refresh_token (self , response_data : Mapping [str , Any ]) -> str | None :
301+ def _extract_refresh_token (self , response_data : Mapping [str , Any ]) -> Any :
301302 """
302303 Extracts the refresh token from the given response data.
303304
304305 Args:
305306 response_data (Mapping[str, Any]): The response data from which to extract the refresh token.
306307
307308 Returns:
308- str: The extracted refresh token or None if not found .
309+ str: The extracted token_expiry_date .
309310 """
310- refresh_token = self ._find_and_get_value_from_response (response_data , self .get_refresh_token_name ())
311- return str (refresh_token ) if refresh_token is not None else None
311+ return self ._find_and_get_value_from_response (response_data , self .get_expires_in_name ())
312312
313313 def _extract_token_expiry_date (self , response_data : Mapping [str , Any ]) -> str | None :
314314 """
0 commit comments