相关疑难解决方法(0)

在哪里可以找到 Google API 客户端的凭据.json?

Google Calender Node.js 示例需要一个名为“credentials.json”的文件:https : //developers.google.com/calendar/quickstart/nodejs

相关代码:

// Load client secrets from a local file.
fs.readFile('credentials.json', (err, content) => {
  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) => {
    if (err) return …
Run Code Online (Sandbox Code Playgroud)

google-calendar-api google-api node.js google-api-client

7
推荐指数
1
解决办法
1万
查看次数