This repository was archived by the owner on May 28, 2024. It is now read-only.
This repository was archived by the owner on May 28, 2024. It is now read-only.
Smart Home: Cache authorization tokens #421
Open
Description
For every requestSync
or reportState
request, a new JWTClient is created, causing a post request to get a new token:
The token that is returned is valid for an hour, but the client and token are still recreated for every request.
I suggest creating the JWTClient just once, on first use, this causes that the token is cached and only refreshed when it is no longer valid.
Furthermore, during the request of a new token, all other requests should wait for this token to finish loading instead of starting a new load.
This will drastically improve the performance and lower the number of requests to the Google Authentication API.
I can create a PR if this is approved.
Metadata
Metadata
Assignees
Labels
No labels