我使用的的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並啓用了它,所以我不知道它會是什麼。
此解決方案的工作原理! –