我尝试了所有可能性,但没有任何解决方案来解决此问题。 我正在使用JWT进行身份验证
我的代码是
const { google } = require('googleapis')
const credentials = require('./credentials.json')
const SCOPE = [
'https://www.googleapis.com/auth/admin.directory.group'
];
const jwt = new google.auth.JWT(
credentials.client_email,
null,
credentials.private_key,
SCOPE
);
jwt.authorize((err, response) => {
if (err) { throw err; }
console.log("You have been successfully authenticated: ");
ggrun(jwt);
});
async function ggrun(cl) {
var googleGroups = google.admin({version: "directory_v1", auth: cl});
try {
const users = await getGoogleGroupsUsers();
} catch (error) {
console.log('error: ', error);
}
/**
* Get Google Groups Users
*/
async function getGoogleGroupsUsers() {
const opt = {
groupKey: 'testing-infoxen@googlegroups.com'
}
try {
const user = await googleGroups.groups.get(opt);
console.log('user: ', user);
} catch( error ) {
console.log('err: ', error);
}
}
}
每次遇到此错误
{域:“全局”, 原因:“未找到”, 消息:“找不到资源:groupKey”}
您能帮我还是向我建议问题出在哪里?