title: How can I authorize Google Speech-to-text from Google Apps script?
body: <p>I'm trying to execute google-speech-to-text from apps script. Unfortunately, I cannot find any examples for apps script or pure HTTP, so I can run it using simple UrlFetchApp.</p>
  
  <p>I created a service account and setup a project with enabled speech-to-text api, and was able 
  to successfully run recognition using command-line example</p>
  
  <blockquote>
    <p>curl -s -H "Content-Type: application/json" \
        -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
        <a href="https://speech.googleapis.com/v1/speech:recognize" rel="nofollow noreferrer">https://speech.googleapis.com/v1/speech:recognize</a> \
        -d @sync-request.json</p>
  </blockquote>
  
  <p>which I can easily translate to UrlFetchApp call, but I don't have an idea to generate access token created by</p>
  
  <blockquote>
    <p>gcloud auth application-default print-access-token</p>
  </blockquote>
  
  <p>Is there a way to get it from apps script using service account credentials?</p>
  
  <p>Or is there any other way to auth and access speech-to-text from apps script?</p>