title: Authenticating in a Google sheets application
body: <p>I have a batch-like application which is periodically invoked by a scheduler, no human user involved. It uses the Perl <a href="http://metacpan.org/pod/Net::Google::Spreadsheets" rel="nofollow noreferrer">Net::Google::Spreadsheets</a> package to update some cells in a Google-sheets spreadsheet, by data fetched from a database.</p>
  
  <p>For a long time it was simple to authenticate itself by just providing a username and a password to the 'new' method of the package. But as of lately, Google require us to authenticate using the OAuth2 protocol.</p>
  
  <p><a href="https://stackoverflow.com/users/4943604/j-t">J.T.</a> provided <a href="https://stackoverflow.com/questions/30476405/netgoogleauthsub-login-failed-with-new-google-drive-version">a solution</a> that I am sure is very helpful to many people more knowledgeable than I am. I will appreciate however if somebody could answer some questions to clarify it, as follows:</p>
  
  <ol>
  <li><p>Creating credentials: once you created a project in the Google Developer Console and you are asking to create a new client ID, you are presented with three options:</p>
  
  <ul>
  <li>For a "Web Application"  (It then asks to provide an "Authorized JavaScript origins" and an "Authorized redirect URIs". Are these relevant to my situation?)</li>
  <li>For a "Service Account" (I Suspect this is the choice  for me, but without answers to the following questions I can't verify it.)</li>
  <li>For an "Installed application" (Can one give examples to such?)</li>
  </ul>
  
  <p>Which one should I choose <em>for may application</em>?</p></li>
  <li><p>Should I asked for a JSON or a P12 key?</p></li>
  <li><p>What do I do with the various types of entities I get? What do I embed in the Perl script?</p></li>
  <li><p>At line 13, J.T commented that "you will need to put code here and receive a token". What kind of code?  Doing what?</p></li>
  <li><p>Since there is no human user, I need the application to do the full authentication process by itself. J.T.'s code prompts a user for a 'code'. Is this code one of the "credentials" entities? How do I do it?</p></li>
  </ol>
  
  <p>In other words, I need somebody to walk me gently through the whole process, step by small step.</p>
  
  <p>Thanks folks!</p>
  
  <p>MeirG</p>