访问被拒绝创build电子表格Google节点API

我正在使用google节点API来生成电子表格。 我使用的第三方库是官方的( https://github.com/google/google-api-nodejs-client )。 以下是我用来生成电子表格的代码:

var sheets = google.sheets('v4'); sheets.spreadsheets.create({ auth: auth, resource: { properties:{ title: "Google export" } } }, (err, response) => { if (err) { console.log('The API returned an error: ' + err); return; } else { console.log("Added"); res.send(response); } }); 

它工作正常,并生成工作表,当我显示响应对象,我得到的电子表格的链接:

spreadsheetUrl:“ https://docs.google.com/spreadsheets/d/1XS_QHxPUQcGqZGAzFHkHZV-RSKsv5IpJazcjVpLTYkk/edit ”

但是,当我尝试在浏览器中打开它时,我不能: You need permission 。 事情是,如果我点击Request accessbutton,我认为它实际上从我的凭据(user@project-174309.iam.gserviceaccount.com)发送一个请求到client_email ,所以它不起作用。 如果我以编程方式打开电子表格,它可以工作…

有谁知道如何在浏览器中打开生成的电子表格?

以下是一个解决scheme: https : //github.com/google/google-api-nodejs-client/issues/804#issuecomment-327931203

需要使用Google Drive API授予此文件的权限