G Suite Admin SDK目录API示例 - “错误:错误请求”

时间:2018-04-17 14:53:27

标签: node.js google-api google-api-nodejs-client gsuite

我正在关注Node.js Quickstart的示例,当我运行它时,我收到了错误

  

“API返回错误:错误:错误请求”。

这是从listUsers(auth)生成的。由于错误是如此模糊,我不确定如何排除故障。

function listUsers(auth) {
    var service = google.admin('directory_v1');
    service.users.list({
        auth: auth,
        customer: 'my_customer',
        maxResults: 10,
        orderBy: 'email'
    }, function(err, response) {
        if (err) {
            console.log('The API returned an error: ' + err);
            return;
        }
        var users = response.users;
        if (users.length == 0) {
            console.log('No users in the domain.');
        } else {
            console.log('Users:');
            for (var i = 0; i < users.length; i++) {
                var user = users[i];
                console.log('%s (%s)', user.primaryEmail, user.name.fullName);
            }
        }
    });

0 个答案:

没有答案