Search code examples
google-apigoogle-api-java-clientgoogle-admin-sdkgoogle-api-clientgoogle-license-manager

google enterprise license manager api - Unauthorized operation for the given domain


The LicenseAssignments.get api returns 200 OK

Request:

GET https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/sku/Google-Apps-For-Business/user/<email>

Response:

200 OK

- Show headers -

{
    "kind": "licensing#licenseAssignment",
    "selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/sku/Google-Apps-For-Business/user/<email>",
    "userId": "<email>",
    "productId": "Google-Apps",
    "skuId": "Google-Apps-For-Business"
}

However LicenseAssignments.listForProduct returns "403 Forbidden"

Request:

GET https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/users?customerId=my_customer

Response:

403 Forbidden

- Show headers -

{
    "error": {
    "errors": [
    {
    "domain": "global",
    "reason": "forbidden",
    "message": "Unauthorized operation for the given domain."
    }
    ],
    "code": 403,
    "message": "Unauthorized operation for the given domain."
    }
}

Any idea why I get 403 forbidden for the second request?


Solution

  • This issue got resolved when I used 'domain name' (e.g. something.com) as 'customerId'. This is different from the usual behavior of other Google APIs where 'customerId' is 'my_customer'.

    https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/users?customerId=<domain name>