0

I'm trying to get the customer domain by using the customers.get API. I already added the scopes in the consent screen:

But I get this error message after do the request (looks like a permission issue):

{
  "error": {
    "code": 403,
    "message": "Requests to this API admin method ccc.hosted.frontend.directory.v1.DirectoryCustomers.Get are blocked.",
    "errors": [
      {
        "message": "Requests to this API admin method ccc.hosted.frontend.directory.v1.DirectoryCustomers.Get are blocked.",
        "domain": "global",
        "reason": "forbidden"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}

For some reason, in Google's API Explorer works perfectly but not in my API Client (Insomnia) nor my web app. In my web app I set the scopes using JavaScript Client library.

Also, I'm using Google Drive, Docs APIs and those work well.

Is there something I'm missing with this API?

Thanks.

Roel Magdaleno
  • 337
  • 5
  • 12

1 Answers1

0

I fixed the issue. The reason was my API key was restricted for 2 APIs in Google Console Cloud:

  • Google Docs API
  • Google Drive API

So I had to add the Admin SDK API to the restrict list:

enter image description here

After that my request works as expected. Thank you.

Roel Magdaleno
  • 337
  • 5
  • 12