我正在制作一个脚本,在nodejs上使用以下脚本从谷歌Electron 表格读取数据:
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,它已经启用,所以我不知道它可能是什么.