我使用的的NodeJS下面的脚本制作一个脚本来读取从谷歌电子表格数据:谷歌电子表格的API请求了验证范围不足
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);
});
但在每一个get请求我得到这个错误:
Request had insufficient authentication scopes.
我检查了Google开发者控制台以启用Google Drive API并启用了它,所以我不知道它会是什么。
此解决方案的工作原理! –