我想提出插入授权请求。根据API Explorer我需要以下范围:
在代码中它看起来像这样:
{
...
, scopes": [
"https://www.googleapis.com/auth/admin.directory.group"
, "https://www.googleapis.com/auth/admin.directory.group.member"
]
}
我有一个pem
用于 JWT 身份验证的文件。让我们看一下代码:
// dependencies
var Assert = require('assert')
, GoogleApis = require('googleapis')
, authData = require("./authData")
;
// output
console.log("Auth data is: ", authData);
// set jwt data
var jwt = new GoogleApis.auth.JWT(
authData.email
, authData.keyFile
, authData.key
, authData.scopes // my scopes
, "ionica.bizau@example.com"
);
// authorize
jwt.authorize(function (err, data) {
// output error
if (err) {
console.log("Error: ", err);
return;
}
/* run authorized requests */
});
我收到以下错误:
{
error: 'access_denied',
error_description: 'Requested scopes not allowed: https://www.googleapis.com/auth/admin.directory.group https://www.googleapis.com/auth/admin.directory.group.member'
}
为什么我会收到此错误?