PHP GAE and the GSuite Directory


My latest adventure has been trying to create a staff directory for my organization’s GSuite user directory. There are commercial versions available, but all are both expensive and don’t do what I need.

This dives me into the somewhat complex world of OAuth authentication and the google API.

There is a php googleapi client, but it consists of 7600 files which seems a bit fat for just issuing a few curl commands.

Authentication to GSuite is described here. Basically, as far as I can tell:

  1. I need to create a service account for my app with it’s credentials. I’ve read in some places that for a GAE you don’t need to tell the app where this is, as it finds it in the standard environment.
  2. I need to give domain-wide delegation to the service account in the GSuite admin.

This is different than I’ve seen in other documents, which uses a delegated admin email.