最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

Google电子表格api请求的身份验证范围不足

IT培训 admin 8浏览 0评论

Google电子表格api请求的身份验证范围不足

我正在使用nodejs上的以下脚本编写脚本以从Google电子表格读取数据:

var url = oauth2Client.generateAuthUrl({
    access_type:     'offline',
    approval_prompt: 'force',
    scope: [
      '.readonly',
      '',
      ''
    ]
});
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并启用了它,所以我真的不知道这可能是什么。

回答如下:
    首先删除凭据文件~/.credentials/sheets.googleapis-nodejs-quickstart.json(取决于您的设置)

Google电子表格api请求的身份验证范围不足

我正在使用nodejs上的以下脚本编写脚本以从Google电子表格读取数据:

var url = oauth2Client.generateAuthUrl({
    access_type:     'offline',
    approval_prompt: 'force',
    scope: [
      '.readonly',
      '',
      ''
    ]
});
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并启用了它,所以我真的不知道这可能是什么。

回答如下:
    首先删除凭据文件~/.credentials/sheets.googleapis-nodejs-quickstart.json(取决于您的设置)
发布评论

评论列表 (0)

  1. 暂无评论