m1racoli commented on code in PR #37138:
URL: https://github.com/apache/airflow/pull/37138#discussion_r1494326804


##########
airflow/providers/google/common/hooks/base_google.py:
##########
@@ -670,7 +670,7 @@ async def acquire_access_token(self, timeout: int = 10) -> 
None:
 
         self.access_token = cast(str, self.credentials.token)
         self.access_token_duration = 3600
-        self.access_token_acquired_at = datetime.datetime.utcnow()
+        self.access_token_acquired_at = 
datetime.datetime.now(tz=datetime.timezone.utc)

Review Comment:
   The instance is initialised with `datetime.datetime(1970, 1, 1)` and once 
`instance.get()` is called this value with get used to determine the age of the 
token 
[here](https://github.com/talkiq/gcloud-aio/blob/auth-4.2.3/auth/gcloud/aio/auth/token.py#L204).
 After token generation we set `access_token_acquired_at`, which later then is 
used to determine the age in subsequent calls of `instance.get()`.
   
   Once we upgraded to version 5 of gcloud-aio-auth we should not need to set 
`access_token_acquired_at` manually as that version provides a [refresh 
function](https://github.com/talkiq/gcloud-aio/blob/4979115547cf07bc93878158e86263833e3839fc/auth/gcloud/aio/auth/token.py#L230C15-L230C22)
 which we can override without taking care of the boilerplate operations.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to