Search code examples
google-apigoogle-appsgoogle-admin-sdkgoogle-directory-api

Google Admin SDK Directory Users List returns group as a user


I'm using the Admin SDK Directory api to read users out of a domain. Everything works fine except for the fact that the users.list is returning groups as part of that list. While not devastating it causes some confusion when users are using my app.

The method in question can be found here.
https://developers.google.com/admin-sdk/directory/v1/reference/users/list

I don't even use the scopes for groups. I have authorization for the https://www.googleapis.com/auth/admin.directory.user.readonly scope only, not any related to groups.

Here is an example of a user entry returned (with names and such obviously changed):

{
  "kind": "admin#directory#user",
  "id": "someId",
  "etag": "\"An etag\"",
  "primaryEmail": "group@domain.com",
  "isAdmin": false,
  "isDelegatedAdmin": false,
  "lastLoginTime": "1970-01-01T00:00:00.000Z",
  "creationTime": "1970-01-01T00:00:00.000Z",
  "agreedToTerms": false,
  "suspended": false,
  "changePasswordAtNextLogin": false,
  "ipWhitelisted": false,
  "emails": [
    {
    "address": "group@domain.com",
    "primary": true
    }
  ],
  "customerId": "customer",
  "orgUnitPath": "/",
  "isMailboxSetup": true,
  "includeInGlobalAddressList": true
}

Solution

  • This is due to a bug in the API. This bug is being tracked on the Google Apps APIs Issue Tracker:

    https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3654