【问题标题】:How do I find the immutable id of my Google Apps account?如何找到我的 Google Apps 帐户的不可变 ID?
【发布时间】:2016-02-03 07:16:38
【问题描述】:

许多 Directory API 调用需要 customer 参数,称为“Google Apps 帐户的不可变 ID。(字符串)”。

例如GET https://www.googleapis.com/admin/directory/v1/customer/客户/domains

我不知道如何为我的 Google Apps 帐户查找/生成此信息。我是管理员。

有人能指点我正确的方向吗?

【问题讨论】:

  • 你可以用自己的账号调用Users.get方法,在响应的最后可以找到customerId。

标签: google-admin-sdk


【解决方案1】:

如果您是某个组织的一员,您可以在此处找到它的组织 ID:https://play.google.com/work/adminsettings?pli=1

它适用于与组织关联的 G Suite 帐户和 Gmail 帐户,但不适用于个人 Gmail 帐户。

【讨论】:

    【解决方案2】:

    我发现的最简单的方法是使用 APIs Explorer at the bottom of the documentation 来实现 Directory API(Admin SDK)上的 Customers: get 方法。在表单上为 customerKey 输入“my_customer”,然后点击“授权并执行”按钮。

    响应将包含 CustomerId(例如 Cxxxxxxxx)作为“id”。 entire response 看起来像这样:

    {
      "kind": "admin#directory#customer",
      "id": string,
      "etag": etag,
      "customerDomain": string,
      "alternateEmail": string,
      "postalAddress": {
        "organizationName": string,
        "countryCode": string,
      },
      "language": string,
      "customerCreationTime": datetime
    }
    

    【讨论】:

      【解决方案3】:

      我能够按如下方式找到 customerId

      1. 转到 admin.google.com
      2. 安全 -> 设置单点登录 (SSO)

      你会看到这样的网址:

      https://accounts.google.com/o/saml2/idp?idpid=Cxxxxxxxx

      那个 Cxxxxxxxx 是你的 customerId

      【讨论】:

      • 这样找不到;也许他们改变了链接结构?
      • 我仍然可以看到相同的 URL 和客户 ID,现在刚刚尝试过。
      【解决方案4】:

      有同样的问题,所以我不得不联系他们的聊天支持。

      官方回答是:
      没有任何 Web 界面可以查找此信息 - 正如我所期望的那样,例如在“组织管理面板”中。获取此信息的唯一方法是通过代码。

      您必须编写额外的代码来请求有关任何现有用户的信息:
      Link to API Docs - 获取:https://www.googleapis.com/admin/directory/v1/users
      在响应中,您可以找到字段 customerId,该字段对于公司所有域中的每个用户都是相同的。

      这是找到您的组织customerId的唯一方法...

      对用户不友好,所以我现在将“功能请求”提交给 Google。

      【讨论】:

      • 这种方法需要客户ID,这让我很困惑。后来我发现可以使用“my_customer”代替客户 ID,而且响应中确实包含了实际的客户 ID。
      猜你喜欢
      • 2020-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多