I want to make an insert authorized request. According to API Explorer I need the following scopes:
In code it would look like this:
{
...
, scopes": [
"https://www.googleapis.com/auth/admin.directory.group"
, "https://www.googleapis.com/auth/admin.directory.group.member"
]
}
I have a pem
file that use for JWT authentication. Let's look at the code:
// 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 */
});
I get the following error:
{
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'
}
Why am I getting this error?