When a user logs on to our Marketplace V2 app, we need to know which Google Apps account the user belongs to.
The id_token contains the 'hd' parameter (the domain name), but that's not enough, as a Google Apps account can have multiple domains.
CustomerId seems like a good primary key to match users to the correct Google Apps account. The problem is, it doesn't seem to be included in the id_token. Is there some way to figure out what the CustomerId of a user is.
The Admin SDK would be one option, but in almost all cases, calls to the Admin SDK fail with "Domain cannot use APIs". I read in a previous answer that Google automatically (re-)enables API access when an administrator installs a Marketplace app, but that can't be true because a call to the Admin SDK hardly ever works.
Does anyone have any suggestions on how to get a customerId or other primary key otherwise, or another trick to get the Admin SDK working (without having to instruct people to change their Google Apps Scurity settings, because that pretty much defeats the point of an effortless Marketplace installation).
Thanks!