diff --git a/app/main.py b/app/main.py index f91390b..6573884 100644 --- a/app/main.py +++ b/app/main.py @@ -40,7 +40,10 @@ def set_points_of_interest(self, pois): self.pois = pois def check_access(self): - if time.time() > self.authdata["expires_at"]: + now = datetime.datetime.fromtimestamp(time.time()) + expires_at = datetime.datetime.fromtimestamp(self.authdata["expires_at"]) + print(f'Access token valid until {expires_at} (now is {now})') + if now >= expires_at: print("Refreshing access token") response = self.client.refresh_access_token( client_id=self.config["client_id"], @@ -50,6 +53,8 @@ def check_access(self): self.authdata["access_token"] = response["access_token"] self.authdata["refresh_token"] = response["refresh_token"] self.authdata["expires_at"] = response["expires_at"] + expires_at = datetime.datetime.fromtimestamp(self.authdata["expires_at"]) + print(f'New access token will expire at {expires_at}') self.authdata_changed = True self.client.access_token = self.authdata["access_token"] diff --git a/web/index.html b/web/index.html index 55e3175..7ad2027 100644 --- a/web/index.html +++ b/web/index.html @@ -7,7 +7,7 @@ - + @@ -82,7 +82,7 @@

Info

- - + +