/* How to refresh your access token (they expire every hour) */ window.setInterval(function(){ refreshToken(); },3000000); //<--this is in milliseconds function refreshToken() { gapi.auth.authorize({'client_id': CLIENT_ID, 'scope': SCOPES.join(' '), 'immediate':true},tokenRefreshed); //you have to get your client id and the proper scopes window.setInterval(function(){ refreshToken(); },3000000); } function tokenRefreshed(result){ }