title: What keyFile key does google.auth.GoogleAuth() need?
body: <h2>Goal</h2>
  
  <p>Using googleapis with firebase functions. Get a JWT token so firebase functions can use a service account with domain-wide delegation to authorize G Suite APIs like directory and drive.</p>
  
  <h2>Question</h2>
  
  <p><strong>What goes in path.join();</strong></p>
  
  <p><strong>What is</strong> <code>__dirname</code>
   <strong>What is</strong> <code>'jwt.keys.json'</code><strong>?</strong></p>
  
  <p><strong>From this example:</strong>
  <a href="https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/jwt.js" rel="nofollow noreferrer">https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/jwt.js</a></p>
  
  <pre><code>  // Create a new JWT client using the key file downloaded from the Google Developer Console
    const auth = new google.auth.GoogleAuth({
      keyFile: path.join(__dirname, 'jwt.keys.json'), // &lt;---- WHAT GOES IN path.join()
      scopes: 'https://www.googleapis.com/auth/drive.readonly',
    });
  </code></pre>
  
  <h2>Error</h2>
  
  <p>When I run</p>
  
  <pre><code>  const auth = new google.auth.GoogleAuth({
      keyFile: path.join(__dirname, "TEST"), // &lt;-- __dirname == /srv/ at runtime
      scopes: 'https://www.googleapis.com/auth/drive.readonly',
    });
  </code></pre>
  
  <p>From the GCP Logs I get this error:</p>
  
  <pre><code>Error: ENOENT: no such file or directory, open '/srv/TEST'
  </code></pre>
  
  <p>Obviously <code>TEST</code> isn't valid, but is <code>'/srv/</code>?</p>
  
  <p>What is the <code>keyFile</code>, a file path? a credential?</p>
  
  <h2>Another Example</h2>
  
  <p><a href="https://github.com/googleapis/google-api-nodejs-client#service-to-service-authentication" rel="nofollow noreferrer">https://github.com/googleapis/google-api-nodejs-client#service-to-service-authentication</a></p>