java-samples
java-samples copied to clipboard
Alert Center API Error: 401 Unauthorised
Sample Name
Alert Center API Quickstart
Expected Behavior
Retrieval of Alert Center Alerts after a successful API call
Actual Behavior
Exception in thread "main" java.io.IOException: Error getting access token for service account: 401 Unauthorized
Specifications
- Java version ('16')
- Windows
- Apache Maven version 3.6.3
Hello. I have been trying to build a script to retrieve Alert Center Reports using a service account authorized to access the domain. Upon running the script, I seem to be running into the aforementioned error inspite of granting domain wide delegation and permission to access the scope (https://www.googleapis.com/auth/apps.alerts) to the said service account. The credentials.json file seems to be up to date for the service account as well.
Here you can view the error message and assorted info.