0

I just had a query regarding a 401 Unauthorized error I seem to have run into while developing a script to pull reports from the Google Alert Center API. I am using the quickstart with a service account and the applicable scope. I have also followed the guide and the credentials.json for the requisite service account seems to be correct as well.

This service account has already been granted Domain Wide Delegation and permission to access the SCOPES. I have also configured the service account to be trusted in the API controls dashboard. Here is the complete error message.

Just to be extra sure, I have also added permission for a user 'admin@xxxx.com' to use the service account as a resource.

Specifications: Windows 10, Java 16, Eclipse IDE, Maven 3.6.3

Could anyone help me figure out what is wrong ?

  • My guess is that you are not impersonating a regular (admin) account, but just using the service account by itself. In order to clarify this, can you provide the authorization part of your code? – Iamblichus Apr 12 '21 at 09:05
  • 1
    @lamblichus You are right !! I misunderstood the quickstart code and had set `private static final String DELEGATED_ADMIN_EMAIL = "admin@xxxx.com";` instead of an account with the proper permissions. – Rahil Mohan Apr 13 '21 at 09:23
  • For documentation purposes, please consider posting an answer explaining what change you did to your code in order for it to work. Or I can provide a more conceptual answer, explaining the difference between enabling domain-wide delegation and actually impersonating an account. – Iamblichus Apr 13 '21 at 09:25

0 Answers0