【发布时间】:2016-07-22 20:29:48
【问题描述】:
我正在制作一个脚本来使用 nodejs 上的以下脚本从谷歌电子表格中读取数据:
var url = oauth2Client.generateAuthUrl({
access_type: 'offline',
approval_prompt: 'force',
scope: [
'https://www.googleapis.com/auth/analytics.readonly',
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/spreadsheets'
]
});
global.googleapis = { expiry_date: 0 };
google.options({ auth: oauth2Client });
var sheets = google.sheets('v4');
sheets.spreadsheets.get({ spreadsheetId: 'id'}, function(err, data) {
res.send(err, data);
});
但在每次获取请求时,我都会收到此错误:
Request had insufficient authentication scopes.
我检查了 Google 开发者控制台以启用 Google Drive API,它已启用,所以我真的不知道它会是什么。
【问题讨论】:
标签: node.js google-api google-spreadsheet-api