title: Long lived access token for Google OAuth 2.0
body: <p>I'm building an application that needs to have access to Google Drive and Google Sheets. I want the user to go to <a href="https://mydomain.appspot.com/authenticate" rel="noreferrer">https://mydomain.appspot.com/authenticate</a> to go through the Google login flow and authenticate themselves so that the backend receives access tokens for both Google Drive and Google Sheets.</p>
  
  <p>After that I want the backend to be able to access Drive and Sheets without user interaction. For example, I would like a scheduled task to run every hour and retrieve some data from Drive and Sheets. I want the backend to use the token it received when the user authenticated themselves.</p>
  
  <p>Is this possible? I really hope so. I have been looking here and I don't really find anything that can help me. <a href="https://developers.google.com/sheets/api/guides/authorizing" rel="noreferrer">https://developers.google.com/sheets/api/guides/authorizing</a></p>
  
  <p>The backend is developed in Java and deployed on Google App Engine.</p>