So this is possible. You have to create a Marketplace App as described here:
https://developers.google.com/workspace/marketplace/how-to-publish
And also enable domain-wide delegation:
https://developers.google.com/admin-sdk/directory/v1/guides/delegation
You then will be able to impersonate admin users for specific (I couldn't figure out a way of authenticating without performing impersonation)
Code snippet in C# - NOT PRODUCTION GRADE CODE
using Google.Apis.Auth.OAuth2;
using Google.Apis.Admin.Directory.directory_v1;
using Google.Apis.Admin.Directory.directory_v1.Data;
using Google.Apis.Services;
using System.Linq;
namespace AdminSDKDirectoryQuickstart
{
class Program
{
static string[] Scopes = { DirectoryService.Scope.AdminDirectoryUserReadonly };
static void Main(string[] args)
{
var credential = GoogleCredential.FromFile("credentials.json")
.CreateWithUser("YOUR_ADMIN_USER@ORGANIZATION.COM")
.CreateScoped(Scopes);
var service = new DirectoryService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential
});
var request = service.Users.List();
request.Customer = "my_customer"; // Alias for the customer of the admin user specified in the credential
request.MaxResults = 500;
var result = request.Execute();
foreach (var user in result.UsersValue)
{
// Do something with the user
}
}
}
}