title: Where to find credentials.json for Google API client?
body: <p>The Google Calender Node.js example requires a file called "credentials.json": <a href="https://developers.google.com/calendar/quickstart/nodejs" rel="noreferrer">https://developers.google.com/calendar/quickstart/nodejs</a></p>
  
  <p>Relevant code:</p>
  
  <pre><code>// Load client secrets from a local file.
  fs.readFile('credentials.json', (err, content) =&gt; {
    if (err) return console.log('Error loading client secret file:', err);
    // Authorize a client with credentials, then call the Google Calendar API.
    authorize(JSON.parse(content), listEvents);
  });
  function authorize(credentials, callback) {
    const {client_secret, client_id, redirect_uris} = credentials.installed;
    const oAuth2Client = new google.auth.OAuth2(
        client_id, client_secret, redirect_uris[0]);
  
    // Check if we have previously stored a token.
    fs.readFile(TOKEN_PATH, (err, token) =&gt; {
      if (err) return getAccessToken(oAuth2Client, callback);
      oAuth2Client.setCredentials(JSON.parse(token));
      callback(oAuth2Client);
    });
  }
  </code></pre>
  
  <p>I don't know where to find this file. The Google API console offers a "download JSON" option, but the file is not in the right format and it is missing the <code>redirect_uris</code> field.</p>