【问题标题】:Get all users from Google domain. Google Admin SDK - Users List获取 Google 域中的所有用户。 Google Admin SDK - 用户列表
【发布时间】:2020-03-05 19:19:11
【问题描述】:

我想调用这个 api https://www.googleapis.com/admin/directory/v1/users

我有一个来自 Google 控制台的应用程序,其中配置了 creditendials。 API 密钥。

我是我的 google gsuite 域的管理员。

我打电话

https://www.googleapis.com/admin/directory/v1/users?domain=xxx-xxx.com&key=xxxxxxxxxxxxxxxxxx

我收到了这条消息

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "required",
                "message": "Login Required",
                "locationType": "header",
                "location": "Authorization"
            }
        ],
        "code": 401,
        "message": "Login Required"
    }
}

我不明白它应该如何工作。

【问题讨论】:

    标签: javascript google-api google-admin-sdk


    【解决方案1】:

    从 G Suite 获取所有用户非常简单。您可以在this 网页中列出来自 Gsuite 的用户的代码。在左侧面板上选择您现在使用的语言。正确遵循指南。无需更改一行代码。我按照 java Quickstart 列出了 G Suite 中的所有用户。

    你也可以试试这个-

    • 您可以使用 Google API Explorer
    • 转到this网页
    • 您可以在 iframe 中找到“试用此 API”或直接按右侧面板上的“试用”按钮
    • 参考页面并提供所需参数。
    • 只需提供您的域和 orderBy 作为参数。
    • 它将打开一个新窗口并要求进行身份验证和授权
    • 完成授权后,您的 Gsuite 中的用户将以 JSON 格式显示。

    【讨论】:

    • 把相关信息复制到这篇文章中,这样以后链接改变时这个答案还是有用的
    • 感谢您的建议 J. Murray。我将编辑我的答案
    猜你喜欢
    • 2014-07-31
    • 1970-01-01
    • 2013-07-10
    • 2014-02-23
    • 1970-01-01
    • 1970-01-01
    • 2014-03-07
    • 1970-01-01
    • 2014-12-20
    相关资源
    最近更新 更多