When using the Google API Client Library for JavaScript, none of the code samples demonstrate how to get a new token after the previous one has expired. Tokens expire after an hour, so it can't be assumed that the initial token will suffice for every user's stay on your site. The part of the FAQ that deals with refreshing tokens suggests to
refresh the auth token after 45 minutes
Which implies that one should set an interval for 45 minutes and refresh the tokens. The problem with that approach is that when your computer goes to sleep, javascript timers are put on hold, and sometimes take some time to fire after resuming the page. Unfortunately, the first thing your user may want to do when they resume using their computer is to check if there are any updates to your site, and when you make an api call for them, it will fail. So we need to check if ou