mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
[depot_tools] Fix timestamp issues related to local auth
Bug: 509672 Change-Id: I5abb813d5f78291b4bf2d8e856c6fd71fcad5b68 Reviewed-on: https://chromium-review.googlesource.com/791472 Commit-Queue: Mun Yong Jang <myjang@google.com> Reviewed-by: Nodir Turakulov <nodir@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
ad3e639bae
commit
1728f5f3e6
12
auth.py
12
auth.py
@@ -200,11 +200,17 @@ def _get_luci_context_access_token(env, now):
|
||||
if expiry:
|
||||
try:
|
||||
expiry_dt = datetime.datetime.utcfromtimestamp(expiry)
|
||||
logging.debug(
|
||||
'local_auth: got an access token for '
|
||||
'account "%s" that expires in %d sec',
|
||||
account_id, (expiry_dt - now).total_seconds())
|
||||
except (TypeError, ValueError):
|
||||
authErr('Invalid expiry in returned token')
|
||||
logging.debug(
|
||||
'local_auth: got an access token for account "%s" that expires in %d sec',
|
||||
account_id, expiry - time.mktime(now.timetuple()))
|
||||
else:
|
||||
logging.debug(
|
||||
'local auth: got an access token for '
|
||||
'account "%s" that does not expire',
|
||||
account_id)
|
||||
access_token = AccessToken(access_token, expiry_dt)
|
||||
if _needs_refresh(access_token, now=now):
|
||||
authErr('local_auth: the returned access token needs to be refreshed')
|
||||
|
||||
Reference in New Issue
Block a user